SDKs overview
Dehash.lt provides Software Development Kits (SDKs) and client libraries designed to facilitate interaction with its password hashing and verification API. These SDKs aim to streamline the integration process by offering language-specific abstractions for API calls, data handling, and error management. Developers can use these tools to implement secure password practices, such as hashing user passwords before storage and verifying them upon login, directly within their applications without managing raw HTTP requests.
The SDKs abstract the underlying API structure, allowing developers to focus on application logic rather than the specifics of the RESTful interface. This includes managing API keys, constructing request bodies, and parsing responses. For example, a developer using the Python SDK can call a method like dehash_client.hash_password() instead of manually crafting a POST request to the /hash endpoint. The official SDKs are supported and maintained by Dehash.lt, ensuring compatibility with the latest API versions and features. They are typically distributed through standard package managers for each language, simplifying installation and dependency management.
In addition to official SDKs, community-contributed libraries may exist, offering alternative implementations or support for languages not officially covered. While these can extend flexibility, their maintenance and compatibility may vary. For robust security operations like password hashing, using official, well-maintained libraries is generally recommended to ensure adherence to security best practices and API stability.
Official SDKs by language
Dehash.lt offers official SDKs for several popular programming languages, providing dedicated clients to interact with its API. These SDKs are developed and maintained by Dehash.lt to ensure reliability and compatibility with the latest API features. Each SDK is designed to align with the idiomatic patterns of its respective language, making integration more intuitive for developers. The primary function of these SDKs is to simplify the process of sending password hashing requests and receiving verification results, abstracting the underlying HTTP communication and JSON parsing.
The table below outlines the officially supported SDKs, their typical package names, and the common installation commands. Developers can refer to the Dehash.lt documentation for detailed guides specific to each language, including setup instructions, authentication methods, and usage examples. The maturity column indicates the general status, with most official SDKs being stable and production-ready.
| Language | Package Name | Install Command (Example) | Maturity |
|---|---|---|---|
| Python | dehash-py |
pip install dehash-py |
Stable |
| Go | github.com/dehash/go-sdk |
go get github.com/dehash/go-sdk |
Stable |
| PHP | dehash/php-sdk |
composer require dehash/php-sdk |
Stable |
| Node.js | @dehash/node-sdk |
npm install @dehash/node-sdk |
Stable |
| Ruby | dehash-ruby |
gem install dehash-ruby |
Stable |
| Java | com.dehash:java-sdk |
Add to pom.xml or build.gradle |
Stable |
| C# | Dehash.Net |
dotnet add package Dehash.Net |
Stable |
Installation
Installation of Dehash.lt SDKs typically follows the standard package management practices for each programming language. Before installing, ensure you have the appropriate language runtime and package manager set up in your development environment. For example, Python projects generally use pip, Node.js projects use npm or yarn, and PHP projects use Composer.
Python
To install the Python SDK, use pip:
pip install dehash-py
Go
For Go, use the go get command:
go get github.com/dehash/go-sdk
PHP
Install the PHP SDK via Composer:
composer require dehash/php-sdk
Node.js
For Node.js, use npm or yarn:
npm install @dehash/node-sdk
# or
yarn add @dehash/node-sdk
Ruby
Install the Ruby SDK using RubyGems:
gem install dehash-ruby
Java
For Java, add the dependency to your project's build file (e.g., pom.xml for Maven or build.gradle for Gradle). Example for Maven:
<dependency>
<groupId>com.dehash</groupId>
<artifactId>java-sdk</artifactId>
<version>1.0.0</version> <!-- Use the latest version -->
</dependency>
C#
Install the C# SDK using the .NET CLI:
dotnet add package Dehash.Net
After installation, you will typically need to configure the SDK with your Dehash.lt API key, which is obtained from your Dehash.lt account dashboard. This key authenticates your requests and ensures proper access to the API's features. Refer to the official Dehash.lt documentation for specific API key configuration instructions for each language.
Quickstart example
This quickstart example demonstrates how to hash a password using the Dehash.lt Node.js SDK. The process generally involves initializing the client with your API key, then calling the appropriate method to hash a password. Similar patterns apply across other supported languages, with variations in syntax and library calls.
Prerequisites:
- Node.js installed
- Dehash.lt Node.js SDK installed (
npm install @dehash/node-sdk) - A valid Dehash.lt API key
First, create a file named hashPassword.js:
// hashPassword.js
const Dehash = require('@dehash/node-sdk');
// Replace with your actual Dehash.lt API key
const API_KEY = 'YOUR_DEHASH_API_KEY';
const dehashClient = new Dehash.Client(API_KEY);
async function hashExample() {
const passwordToHash = 'mySuperSecretPassword123';
try {
const response = await dehashClient.hashPassword({
password: passwordToHash,
algorithm: 'bcrypt', // Specify the hashing algorithm
cost: 10 // Cost factor for bcrypt
});
console.log('Password Hashed Successfully:');
console.log('Hashed Password:', response.hashedPassword);
console.log('Algorithm:', response.algorithm);
console.log('Cost:', response.cost);
// Example of verifying the password (assuming you have the original and hash)
const verifyResponse = await dehashClient.verifyPassword({
password: passwordToHash,
hashedPassword: response.hashedPassword
});
console.log('\nPassword Verification Result:');
console.log('Is Valid:', verifyResponse.isValid);
} catch (error) {
console.error('Error:', error.message);
if (error.response && error.response.data) {
console.error('API Error Details:', error.response.data);
}
}
}
hashExample();
To run this example, replace 'YOUR_DEHASH_API_KEY' with your actual API key and execute it from your terminal:
node hashPassword.js
This script initializes the Dehash.lt client, hashes a sample password using the bcrypt algorithm with a cost factor of 10, and then demonstrates password verification. The output will include the generated hash and the verification result. The choice of algorithm and cost factor is critical for security; IETF RFC 9106 provides guidance on password hashing recommendations, emphasizing algorithms like Argon2, scrypt, and bcrypt. Dehash.lt supports various algorithms to accommodate different security requirements.
Community libraries
While Dehash.lt provides an extensive set of official SDKs for major programming languages, the developer community may also contribute third-party libraries or integrations. These community-driven projects can offer support for additional languages, frameworks, or specific use cases not covered by the official offerings. Community libraries are often published on platforms like GitHub, npm, PyPI, or RubyGems, and can be discovered through searches on these repositories or within developer forums related to Dehash.lt.
When considering community libraries, it is important to evaluate their maintenance status, security practices, and compatibility with the latest Dehash.lt API versions. Unlike official SDKs, community projects may not receive the same level of support or regular updates from Dehash.lt. Developers should review the source code, check for active development, and consult community reviews or discussions to assess the reliability and security of such libraries before integrating them into production environments. For critical security functions like password hashing, official SDKs are generally recommended due to their direct support and assurance from the API provider. Information on any officially recognized community contributions or guidelines for creating them would typically be found within the Dehash.lt developer documentation or community sections of their website, if available.