Home Reference Source Test
import Whirlpool from 'crypto-api/src/hasher/whirlpool.mjs'
public class | source

Whirlpool

Extends:

src/hasher/hasher32be.js~Hasher32be → Whirlpool

Example:

Calculates WHIRLPOOL hash from string "message" - ES6 style
import Whirlpool from "crypto-api/src/hasher/whirlpool";
import {toHex} from "crypto-api/src/encoder/hex";

let hasher = new Whirlpool();
hasher.update('message');
console.log(toHex(hasher.finalize()));
Calculates WHIRLPOOL hash from UTF string "message" - ES6 style
import Whirlpool from "crypto-api/src/hasher/whirlpool";
import {toHex} from "crypto-api/src/encoder/hex";
import {fromUtf} from "crypto-api/src/encoder/utf";

let hasher = new Whirlpool();
hasher.update(fromUtf('message'));
console.log(toHex(hasher.finalize()));
Calculates WHIRLPOOL hash from string "message" - ES5 style
<script src="https://nf404.github.io/crypto-api/crypto-api.min.js"></script>
<script>
  var hasher = CryptoApi.getHasher('whirlpool');
  hasher.update('message');
  console.log(CryptoApi.encoder.toHex(hasher.finalize()));
</script>
Calculates WHIRLPOOL hash from UTF string "message" - ES5 style
<script src="https://nf404.github.io/crypto-api/crypto-api.min.js"></script>
<script>
  console.log(CryptoApi.hash('whirlpool', 'message'));
</script>

Test:

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:

NameTypeAttributeDescription
options Object
  • optional
options.rounds number
  • optional
  • default: 10

Number of rounds (Can be from 1 to 10)

options.type string
  • optional

Algorithm type

Hash type Type
whirlpool-0 '0'
whirlpool-t 't'
whirlpool undefined

Public Methods

public finalize(): string source

Finalize hash and return result

Return:

string

public reset() source

Reset hasher to initial state