carbond.security.Sha256Hasher

extends Hasher

A utility class for the SHA-256 hash function

Instance Properties

digestType
string
Default hex
Description the type of digest to output. Can be hex, latin1, or base64.

Abstract Methods

eq
Inherited fromHasher
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

Methods

getHasher
Inherited fromHasher
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
Inherited fromHasher
Returns registered hasher names
Return type string[]
Description Get the names of all registered hashers.
hash  
Arguments
  • data (string) – the data to hash
Returns the SHA-256 digest
Return type string
Description Calculates the SHA-256 digest of the input string