Md2
Extends:
src/hasher/hasher8.js~Hasher8 → Md2
Calculates MD2 hash
Example:
import Md2 from "crypto-api/src/hasher/md2";
import {toHex} from "crypto-api/src/encoder/hex";
let hasher = new Md2();
hasher.update('message');
console.log(toHex(hasher.finalize()));
import Md2 from "crypto-api/src/hasher/md2";
import {toHex} from "crypto-api/src/encoder/hex";
import {fromUtf} from "crypto-api/src/encoder/utf";
let hasher = new Md2();
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('md2');
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('md2', '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:
Name | Type | Attribute | Description |
options | Object |
|
|
options.rounds | number |
|
Number of rounds (Must be greater than 0) |