carbond.security.Hasher

A utility class for cryptographic hash functions

Abstract Methods

eq  
Arguments
  • data (string) – the data in its raw form
  • digest (string) – the digest to compare against
Returns true if the data evaluates to digest
Return type boolean
Description Compares data against a digest
hash  
Arguments
  • data (string) – the data to hash
Returns the digest
Return type string
Description Calculates the hash digest of the input string

Methods

getHasher  
Arguments
  • name (string) – the name of a hasher. Supported hashers are noop, sha256, and bcrypt.
Returns the constructor for a hasher or undefined if not found
Return type function | undefined
Description Get a hasher class by name.
getHasherNames  
Returns registered hasher names
Return type string[]
Description Get the names of all registered hashers.