blossom/fnv~ FNV

new FNV(streamOptionsopt)

Implements FNV hash function.

Parameters:
NameTypeAttributesDescription
streamOptionsobject<optional>

https://nodejs.org/api/stream.html#api-for-stream-consumers

Examples
const { fnv } = require('@yipsec/blossom');
const fnvHash = fnv.createHash();

fnvHash.update('acab', 'hex');
console.log(fnvHash.digest('hex'));
const { fnv } = require('@yipsec/blossom');
const fnvHash = new fnv.FNV();

fnvHash.write('acab', 'hex');
fnvHash.pipe(process.stdout);

Extends

  • stream.Transform

Methods

digest(encodingopt) → {string|Buffer}

Returns the computed FNV hash

Parameters:
NameTypeAttributesDescription
encodingstring<optional>

Encoding type to return

Returns:
Type: 
string | Buffer

update(data, encodingopt) → {FNV}

Updates the hash function with the given data

Parameters:
NameTypeAttributesDescription
datastring | Buffer

Data to hash

encodingstring<optional>

If data is a string, specify the encoding

Returns:
Type: 
FNV

value() → {number}

Returns the current hash value

Returns:
Type: 
number