Class: Hasher

Hasher

Abstract class providing shared functionality to Hasher subclasses.

<virtual> new Hasher()

NOTE: you can't instantiate this class directly. Instead, create instances of a subclass, such as SHA1 or MD5.
Source:

Requires

  • module:convert

Methods

clear()

Initializes class member values. Invoked by the clear method from a subclass instance.
Source:

finalize(options) → {string|Array}

Finalizes the hash and returns the result. This is called internally by the hash method of the Hasher subclass instance when streaming mode is turned off. It should be called explicitly when using streaming mode after all data is passed into the hash method.
Parameters:
Name Type Description
options Object Optional options object (descriptions of parameters below)
Properties
Name Type Argument Default Description
return_format string <optional>
hex (binary|hex|words) The return format. Default: hex
Source:
Returns:
A string or array depending on options.return_format
Type
string | Array

get_block_size() → {number}

Returns the block size in bits for the current instance
Source:
Returns:
The block size in bits.
Type
number

get_outlen() → {number}

Returns the length in bits of the output block for this instance
Source:
Returns:
The output block size in bits.
Type
number