Hash Generator
The /hash_generator endpoint generates hash string for any given text. It supports three algorithms: bcrypt, SHA-256, and MD5.
Method: POST
To generate a hash string, send the required parameters with the authorization header, to the /hash_generator endpoint via POST method.
Parameters
This endpoint takes three parameters, namely, algorithm, text and salt_rounds.
algorithmis the name of the algorithm which will be used to generate the hash. Supported values are:bcrypt,sha256andmd5. It is required.textis the text, from which the hash will be generated. It is also required.salt_roundsis the number of times, the provided string will be hashed. It is only used forbcrypt, and else it is ignored. The default value is8. The maximum value is12and if the providedsalt_roundsexceeds the limit, an error will be thrown.
Responses
The success response for the string, "Puppies are cutes.", looks like this:
{
"status": "success",
"data": {
"algorithm": "bcrypt",
"hash": "$2b$08$Tik/SENBhlAqju25bJApteC9P6coPGwD5NnashlFnOZkeN2FsA.TK"
},
"message": "Hashing completed successfully."
}
JSON
And, if we don't provide either algorithm or text parameter, the response would be like this:
{
"status": "error",
"error": {
"code": "INVALID_ALGORITHM",
"message": "Supported algorithms are: bcrypt, sha256, and md5.",
"details": null
}
}
JSON
Notes
bcrypthashes are not generated the same again, even for the same string. Hence, comparing them is not simple, but we can still match them via the/hash_matcherendpoint.- Also, MD5 is strictly not recommended, for any confidential information, as it is not secure.