Files
common/packages/util-crypto/docs/xxhash32.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.4 KiB

xxhash32

Create XXHash values as BN, hex & number output

xxhash32AsBn

Creates a xxhash BN from the input.

xxhash32AsBn (data: Buffer | Uint8Array | string, seed: number): BN

From either a string, Uint8Array or a Buffer input, create the xxhash and return the result as a BN.

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

xxhash32AsBn('abcd', 0xabcd)) // => new BN(0xcda8fae4)

xxhash32AsHex

Creates a xxhash hex from the input.

xxhash32AsHex (data: Buffer | Uint8Array | string, seed: number): string

From either a string, Uint8Array or a Buffer input, create the xxhash and return the result as a hex string.

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

xxhash32AsHex('abcd', 0xabcd)) // => 0xcda8fae4

xxhash32AsRaw

Creates a xxhash non-prefixed hex from the input.

xxhash32AsRaw (data: Buffer | Uint8Array | string, seed: number): string

From either a string, Uint8Array or a Buffer input, create the xxhash and return the result as a non-prefixed hex string.

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

xxhash32AsRaw('abcd', 0xabcd)) // => cda8fae4