bcrypt
This module provides functions for generating and verifying bcrypt hashes as well as functions for getting informations from a bcrypt hash.
Properties
- bcrypt.DEFAULT_LOG2_ROUNDS
- Default log2 rounds (default: 10) type number
- bcrypt.MAX_EXECUTION_TIME
- Maximum execution time for each cipher iteration in milliseconds (default: 100) type number
Functions
- 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 Exceptionreturn string
- bcrypt.compare(str: string, known_hash: string)
- Tests a string against a known hash. throws Exceptionreturn string
- bcrypt.get_rounds(hash: string)
- Gets the number of rounds used to encrypt the specified hash. throws Exceptionreturn number
- bcrypt.get_salt(hash: string)
- Gets the salt portion from a hash.
- This function does not validate the hash.
throws Exceptionreturn string