Home Reference Source Test
public class | source

Ripemd

Extends:

src/hasher/hasher32le.js~Hasher32le → Ripemd

Example:

Calculates RIPEMD-160 hash from string "message" - ES6 style
import Ripemd from "crypto-api/src/hasher/ripemd";
import {toHex} from "crypto-api/src/encoder/hex";

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

let hasher = new Ripemd();
hasher.update(fromUtf('message'));
console.log(toHex(hasher.finalize()));
Calculates RIPEMD-160 hash from string "message" - ES5 style
<script src="https://nf404.github.io/crypto-api/crypto-api.min.js"></script>
<script>
  var hasher = CryptoApi.getHasher('ripemd160');
  hasher.update('message');
  console.log(CryptoApi.encoder.toHex(hasher.finalize()));
</script>
Calculates RIPEMD-160 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('ripemd160', '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.length number
  • optional
  • default: 160

Length of hash result

Hash type Length
ripemd128 128
ripemd160 160
ripemd256 256
ripemd320 320

Public Methods

public finalize(): string source

Finalize hash and return result

Return:

string

public reset() source

Reset hasher to initial state