$k. Hash

new Hash()

Methods

digest(encodingopt) → {string}

Calculates the digest of the data passed to this object.

Parameters:
NameTypeAttributesDescription
encodingstring<optional>

Optional encoding of the output.

Version
  • Experimental feature, might be removed at any time
Returns:

If no encoding is given, an array of integers is returned, otherwise a string with the given encoding.

Type: 
string

hash(data, inputEncodingopt, outputEncodingopt) → {string}

Hashes the given data. This is a shorthand for calling reset, update and digest and changes the object state.

Parameters:
NameTypeAttributesDescription
datastring

The data to hash.

inputEncodingstring<optional>

Optional input encoding.

outputEncodingstring<optional>

Optional output encoding.

Version
  • Experimental feature, might be removed at any time
Returns:

The hashed data as array of integers.

Type: 
string

reset() → {$k.Hash}

Resets the hash to its initial state.

Version
  • Experimental feature, might be removed at any time
Returns:

The hash itself.

Type: 
$k.Hash

update(data, encodingopt) → {$k.Hash}

Adds the given data to the hash.

Parameters:
NameTypeAttributesDescription
datastring

The data to hash.

encodingstring<optional>

Optional input encoding.

Version
  • Experimental feature, might be removed at any time
Returns:

The hash object itself.

Type: 
$k.Hash