Crypto API
We provide a lightweight API for hashing any text and validating the text and a previous returned hash. This API is perfect for password management, where you can get a hash for a password, and then validate the password with the saved hash from your database for example.
Algorithm
We are using the bcrypt algorithm for hashing and we also do salting to provide extra security.
Endpoints
We are providing two endpoints as of now - one for hashing the text and one for validating a hash with a text.
GET /crypto/hash?plain={text}
Example of how we can hash a text
const response = await fetch( "https://api.algobook.info/v1/crypto/hash?plain=admin123" ); const data = await response.json(); console.log(data.hashed);
Response
{ "hashed": "$2b$10$E8MjVaVFJXI1wHIkx1pEie9DlVM.1cfujYXRopHLMoA./LfIO0tjO" }
GET /crypto/validate?plain={text}&hashed={hashedValue}
To validate a text, we can do as follows
const response = await fetch( "https://api.algobook.info/v1/crypto/validate?plain=admin123&hashed=$2b$10$umTaBzbKwUbegT7Vwk75zukmp1I/tZLTIJJjEkKmXPeA1Bj.rvTyS" ); const data = await response.json(); console.log(data.valid);
Response
{ "valid": true }
Feedback
If you have any feedback or feature requests - please don't hesitate to contact us here. We love to improve our software.