Files
common/packages/util-crypto/docs/xxhash.md
T
Jaco Greeff 523dc1c48d Update hashing functions to ref (#68)
* Package upgrades

* Use h64 by default

* Remove AsNumber distinction

* xxhash32/64 & blake2b/2s

* Add xxhashAsHex{128,256}

* Add blake2AsHex{128,256,512}

* Update documentation

* Update docs
2018-01-30 11:55:32 +01:00

1.5 KiB

xxhash

Create xxhash64 values with specified bitlengths

xxhashAsHex

Creates a xxhash64 hex from the input.

xxhashAsHex (data: Buffer | Uint8Array | string, bitLenght: number = 64): string

From either a string, Uint8Array or a Buffer input, create the xxhash64 and return the result as a hex string with the specified bitLength.

import { xxhashAsHex } from '@polkadot/util-crypto';

xxhashAsHex('abc')) // => 0x44bc2cf5ad770999

xxhashAsHex128

Creates a xxhash64 hex with 128-bits from the input.

xxhashAsHex128 (data: Buffer | Uint8Array | string): string

From either a string, Uint8Array or a Buffer input, create the xxhash64 and return the result as a hex string with 128 bits.

import { xxhashAsHex128 } from '@polkadot/util-crypto';

xxhashAsHex128('abc')) // => 0x44bc2cf5ad770999

xxhashAsHex256

Creates a xxhash64 hex with 256-bits from the input.

xxhashAsHex256 (data: Buffer | Uint8Array | string): string

From either a string, Uint8Array or a Buffer input, create the xxhash64 and return the result as a hex string with 256 bits.

import { xxhashAsHex256 } from '@polkadot/util-crypto';

xxhashAsHex256('abc')) // => 0x44bc2cf5ad770999bea9ca8199328908