Snefru
Extends:
src/hasher/hasher32be.js~Hasher32be → Snefru
Calculates Snefru v2.0 (2 rounds 128, 4 rounds 256), Snefru v2.5 (8 rounds) hash
Example:
import Snefru from "crypto-api/src/hasher/snefru";
import {toHex} from "crypto-api/src/encoder/hex";
let hasher = new Snefru();
hasher.update('message');
console.log(toHex(hasher.finalize()));
import Snefru from "crypto-api/src/hasher/snefru";
import {toHex} from "crypto-api/src/encoder/hex";
import {fromUtf} from "crypto-api/src/encoder/utf";
let hasher = new Snefru();
hasher.update(fromUtf('message'));
console.log(toHex(hasher.finalize()));
<script src="https://nf404.github.io/crypto-api/crypto-api.min.js"></script>
<script>
var hasher = CryptoApi.getHasher('snefru');
hasher.update('message');
console.log(CryptoApi.encoder.toHex(hasher.finalize()));
</script>
<script src="https://nf404.github.io/crypto-api/crypto-api.min.js"></script>
<script>
console.log(CryptoApi.hash('snefru', 'message'));
</script>
Constructor Summary
Public Constructor | ||
public |
constructor(options: Object) |
Method Summary
Public Methods | ||
public |
finalize(): string Finalize hash and return result |
|
public |
reset() Reset hasher to initial state |
Public Constructors
public constructor(options: Object) source
Params:
Name | Type | Attribute | Description | |||||||||||||||
options | Object |
|
|
|||||||||||||||
options.rounds | number |
|
Number of rounds (Can be from 2 to 8) |
|||||||||||||||
options.length | number |
|
Length of hash result (Can be from 32 to 480 with step 32). Be careful, increasing of length will cause a reduction of the block size |