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.

  • algorithm is the name of the algorithm which will be used to generate the hash. Supported values are: bcrypt, sha256 and md5. It is required.
  • text is the text, from which the hash will be generated. It is also required.
  • salt_rounds is the number of times, the provided string will be hashed. It is only used for bcrypt, and else it is ignored. The default value is 8. The maximum value is 12 and if the provided salt_rounds exceeds 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."
}

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
  }
}

Notes

  • bcrypt hashes 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_matcher endpoint.
  • Also, MD5 is strictly not recommended, for any confidential information, as it is not secure.