Link Search Menu Expand Document

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 Exception
return string
bcrypt.compare(str: 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.