new FNV(streamOptionsopt)
Implements FNV hash function.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
streamOptions | object | <optional> |
- Source
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:
Name | Type | Attributes | Description |
---|---|---|---|
encoding | string | <optional> | Encoding type to return |
- Source
Returns:
- Type:
- string |
Buffer
update(data, encodingopt) → {FNV}
Updates the hash function with the given data
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
data | string | | Data to hash | |
encoding | string | <optional> | If data is a string, specify the encoding |
- Source
Returns:
- Type:
- FNV
value() → {number}
Returns the current hash value
- Source
Returns:
- Type:
- number