Getting started overview
Integrating Dehash.lt involves a sequence of steps designed to enable secure password management within an application. The core functionality revolves around hashing and verifying passwords through a dedicated API. This guide outlines the essential procedures, beginning with account setup and API key acquisition, followed by the execution of a first successful API call. Dehash.lt provides various SDKs to streamline the integration process for multiple programming languages, including Python, PHP, and Node.js, alongside direct HTTP API access.
The primary use case for Dehash.lt is to offload the complexities of secure password storage from application developers, providing a focused service for cryptographic operations like hashing and verification. The service supports widely recognized hashing algorithms and aims to simplify compliance with security best practices for handling user credentials. Before making API requests, it is necessary to establish an authenticated session using API keys obtained from the Dehash.lt dashboard after registration.
Quick Reference: Dehash.lt Getting Started
| Step | What to Do | Where |
|---|---|---|
| 1. Sign Up | Create a Dehash.lt account. | Dehash.lt Signup Page |
| 2. Get API Keys | Locate and copy your API keys from the dashboard. | Dehash.lt Dashboard > API Keys section |
| 3. Install SDK (Optional) | Install the relevant Dehash.lt SDK for your language. | Dehash.lt SDK Documentation |
| 4. Configure Authentication | Set up your API key for authentication in your code. | Your application code |
| 5. Make First Request | Send a password hashing request to the API. | Your application code / Terminal (for cURL) |
| 6. Verify Success | Check the API response for the hashed password. | API response payload |
Create an account and get keys
To begin using Dehash.lt, the initial step is to create a user account. This account provides access to the Dehash.lt dashboard, where API keys are managed and usage statistics are monitored. The signup process is typically a standard web registration, requiring an email address and password. Upon successful registration, users are directed to their dashboard.
API keys are fundamental for authenticating requests to the Dehash.lt API. These keys link API calls to your specific account and its associated usage plan. Dehash.lt employs an API key model for authentication, a common practice for securing access to web services Google Maps Platform API key authentication. Your API keys are available within the dashboard, usually under a section titled 'API Keys' or 'Credentials'. It is crucial to treat these keys as sensitive information, similar to passwords, to prevent unauthorized access to your Dehash.lt account and services.
When generating or retrieving your API keys, Dehash.lt typically provides at least one key for production use and potentially separate keys for development or testing environments. These keys are unique identifiers. For security, it is recommended to store API keys securely, for example, using environment variables rather than hardcoding them directly into your application's source code. This practice minimizes the risk of exposure if your codebase is compromised or publicly accessible.
The free tier offers 5,000 hashes per month, which allows for initial development and testing without incurring costs. Details on usage and pricing tiers are available on the Dehash.lt pricing page. Once your account is set up and API keys are obtained, you are ready to configure your application to interact with the Dehash.lt API.
Your first request
After acquiring your API keys, the next step is to make your first authenticated request to the Dehash.lt API. This section demonstrates how to hash a password using the API, providing examples for common programming languages and a cURL example for direct HTTP interaction.
Authentication Header
All requests to the Dehash.lt API require your API key to be included in the Authorization header, typically as a Bearer token. The format is Authorization: Bearer YOUR_API_KEY.
Hashing a Password (Python Example)
Using the Python SDK simplifies making API calls. First, install the SDK:
pip install dehashlt
Then, make a hashing request:
import dehashlt
# Replace with your actual Dehash.lt API key
dehash_client = dehashlt.Client(api_key="YOUR_API_KEY")
try:
password_to_hash = "mySecurePassword123"
hashed_response = dehash_client.hash_password(password_to_hash)
print(f"Hashed password: {hashed_response['hash']}")
print(f"Salt used: {hashed_response['salt']}")
except dehashlt.DehashltError as e:
print(f"Error hashing password: {e}")
Hashing a Password (Node.js Example)
For Node.js, install the SDK:
npm install dehashlt
Example request:
const Dehashlt = require('dehashlt');
// Replace with your actual Dehash.lt API key
const dehashClient = new Dehashlt.Client({ apiKey: 'YOUR_API_KEY' });
async function hashMyPassword() {
try {
const passwordToHash = 'mySecurePassword123';
const hashedResponse = await dehashClient.hashPassword(passwordToHash);
console.log(`Hashed password: ${hashedResponse.hash}`);
console.log(`Salt used: ${hashedResponse.salt}`);
} catch (error) {
console.error(`Error hashing password: ${error.message}`);
}
}
hashMyPassword();
Hashing a Password (cURL Example)
For a direct HTTP request without an SDK, you can use cURL:
curl -X POST \
https://api.dehash.lt/v1/hash \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-d '{"password": "mySecurePassword123"}'
The API response for a successful hash request will typically include the generated hash, the salt used (if applicable and visible), and potentially the algorithm identifier, as detailed in the Dehash.lt API reference.
Common next steps
Once you have successfully made your first password hashing request, several common next steps emerge to fully integrate Dehash.lt into your application's security architecture:
-
Password Verification: Implement the verification endpoint to check if a user-provided password matches a previously hashed password stored in your database. This is critical for user login flows. The API typically requires the plain-text password and the stored hash (and sometimes the salt) for comparison.
# Example: Verifying a password (Python) import dehashlt dehash_client = dehashlt.Client(api_key="YOUR_API_KEY") try: user_input_password = "mySecurePassword123" stored_hash = "$2b$10$EXAMPLEHASHEDPASSWORDHERE..." stored_salt = "$2b$10$EXAMPLESALT..." is_valid = dehash_client.verify_password(user_input_password, stored_hash) if is_valid: print("Password is valid.") else: print("Invalid password.") except dehashlt.DehashltError as e: print(f"Error verifying password: {e}") -
Error Handling and Logging: Implement robust error handling for API calls. This includes catching network errors, authentication failures (e.g., invalid API key), and invalid input errors from the Dehash.lt service. Logging these errors can aid in debugging and monitoring the health of your integration.
-
Environment Configuration: Distinguish between development, staging, and production environments. Use separate API keys for each environment and manage them securely, often through environment variables or a secrets management service. This prevents development activities from impacting production usage metrics or security.
-
Rate Limiting Considerations: Understand the rate limits imposed by Dehash.lt on its API endpoints. Design your application to handle potential rate limit responses gracefully, perhaps by implementing retry mechanisms with exponential backoff. This prevents your application from being temporarily blocked due to excessive requests. Information on rate limits is typically found in the Dehash.lt documentation.
-
SDK Integration vs. Raw HTTP: While direct HTTP calls (like cURL) are useful for testing, integrating one of Dehash.lt's official SDKs (Python, Go, PHP, Node.js, Ruby, Java, C#) is generally recommended for production applications. SDKs abstract away much of the boilerplate code for HTTP requests, authentication, and response parsing, leading to cleaner and more maintainable code.
-
Migration Strategies: If you are migrating an existing system with stored passwords, consult Dehash.lt's documentation on migration strategies. This often involves rehashing existing passwords upon user login or a background process. For instance, if your system previously used a less secure hashing method, you might hash the existing password with Dehash.lt's service the next time a user logs in, then update the stored hash.
-
Security Best Practices: Review general security best practices for password management, such as encouraging strong passwords, implementing multi-factor authentication (MFA) with other services, and regularly auditing your security configurations. Google Cloud's identity security best practices provide a broader context for securing user identities.
Troubleshooting the first call
Encountering issues during your first API call is common. Here's a guide to troubleshooting typical problems with Dehash.lt:
-
Invalid API Key:
- Symptom: API returns an authentication error (e.g., HTTP 401 Unauthorized).
- Solution: Double-check that you are using the correct API key from your Dehash.lt dashboard. Ensure there are no leading or trailing spaces, and that the key is copied entirely. Verify it's placed correctly in the
Authorization: Bearer YOUR_API_KEYheader.
-
Missing or Incorrect Content-Type Header:
- Symptom: API returns an error related to unsupported media type (e.g., HTTP 415 Unsupported Media Type) or bad request (HTTP 400).
- Solution: For most Dehash.lt API endpoints, especially those accepting JSON payloads, you must include the header
Content-Type: application/json. Verify this is present and correctly formatted in your request.
-
Incorrect Endpoint URL:
- Symptom: API returns a 404 Not Found error.
- Solution: Confirm that the URL you are sending the request to matches the Dehash.lt API documentation's specified endpoint. For hashing, it's typically
https://api.dehash.lt/v1/hash.
-
Invalid Request Body:
- Symptom: API returns a 400 Bad Request error, often with a message indicating missing or malformed parameters.
- Solution: Ensure your JSON request body is valid and contains all required parameters, such as the
"password"field for the hashing endpoint. Check for correct JSON syntax (e.g., proper quotes, commas).
-
Network Connectivity Issues:
- Symptom: Request times out or fails with a network-related error.
- Solution: Check your internet connection. If running from a restricted environment, ensure that outbound connections to
api.dehash.lton HTTPS (port 443) are allowed by any firewalls or proxies.
-
SDK-Specific Errors:
- Symptom: Errors originating from the SDK itself, such as import errors or method not found.
- Solution: Verify that the Dehash.lt SDK is correctly installed and updated to the latest version. Consult the specific Dehash.lt SDK documentation for your programming language for correct usage patterns and troubleshooting steps.
-
Exceeding Free Tier Limits:
- Symptom: API returns an error indicating a quota or rate limit exceeded.
- Solution: Check your Dehash.lt dashboard for current usage statistics. If you've exceeded the 5,000 hashes/month free tier, consider upgrading to a paid plan or pausing development until your quota resets.