Class: Hash

$k. Hash

new $k.Hash()

Methods

digest(encoding) : string

Calculates the digest of the data passed to this object.

Name Type Description
encoding string optional

Optional encoding of the output.

Version:
  • Experimental feature, might be removed at any time
Returns:
Type Description
string If no encoding is given, an array of integers is returned, otherwise a string with the given encoding.

hash(data, inputEncoding, outputEncoding) : string

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

Name Type Description
data string

The data to hash.

inputEncoding string optional

Optional input encoding.

outputEncoding string optional

Optional output encoding.

Version:
  • Experimental feature, might be removed at any time
Returns:
Type Description
string The hashed data as array of integers.

reset() : $k.Hash

Resets the hash to its initial state.

Version:
  • Experimental feature, might be removed at any time
Returns:
Type Description
$k.Hash The hash itself.

update(data, encoding) : $k.Hash

Adds the given data to the hash.

Name Type Description
data string

The data to hash.

encoding string optional

Optional input encoding.

Version:
  • Experimental feature, might be removed at any time
Returns:
Type Description
$k.Hash The hash object itself.