Link Search Menu Expand Document


This module provides functions for generating and verifying bcrypt hashes as well as functions for getting informations from a bcrypt hash.


Default log2 rounds (default: 10)
type number
Maximum execution time for each cipher iteration in milliseconds (default: 100)
type number


bcrypt.hash(str: string [, salt_length: number])
Generates a hash for the given string. If salt_length is not given, the length of the salt will be equal to DEFAULT_LOG2_ROUNDS.
throws Exception
return string string, known_hash: string)
Tests a string against a known hash.
throws Exception
return string
bcrypt.get_rounds(hash: string)
Gets the number of rounds used to encrypt the specified hash.
throws Exception
return number
bcrypt.get_salt(hash: string)
Gets the salt portion from a hash.
  • This function does not validate the hash.
throws Exception
return string

Back to top

Copyright © 2021 Ore Richard Muyiwa. Distributed under the MIT license.