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

xxhash64

Create XXHash values as BN, hex & number output

xxhash64AsBn

Creates a xxhash BN from the input.

xxhash64AsBn (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 { xxhash64AsNumber } from '@polkadot/util-crypto';

xxhash64AsBn('abcd', 0xabcd)) // => new BN(0xe29f70f8b8c96df7)

xxhash64AsHex

Creates a xxhash hex from the input.

xxhash64AsHex (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 { xxhash64AsHex } from '@polkadot/util-crypto';

xxhash64AsHex('abcd', 0xabcd)) // => 0xe29f70f8b8c96df7

xxhash64AsRaw

Creates a xxhash non-prefixed hex from the input.

xxhash64AsRaw (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 { xxhash64AsRaw } from '@polkadot/util-crypto';

xxhash64AsRaw('abcd', 0xabcd)) // => e29f70f8b8c96df7