* 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
1.5 KiB
1.5 KiB
blake2b
Create Blake2b values as hex, Buffer & Uint8Array output
- blake2bAsBuffer Creates a blake2b Buffer from the input.
- blake2bAsHex Creates a blake2b hex string from the input.
- blake2bAsU8a Creates a blake2b Uint8Array from the input.
blake2bAsBuffer
Creates a blake2b Buffer from the input.
blake2bAsBuffer (value: Uint8Array): Buffer
From a Uint8Array input, create the blake2b and return the result as a Buffer.
import { blake2bAsBuffer } from '@polkadot/util-crypto';
blake2bAsBuffer('abc') // => Buffer.from('ba80a53f981c4d0d6a2797b69f12f6e94c212f14685ac4b74b12bb6fdbffa2d17d87c5392aab792dc252d5de4533cc9518d38aa8dbf1925ab92386edd4009923', 'hex')
blake2bAsHex
Creates a blake2b hex string from the input.
blake2bAsHex (value: Uint8Array): string
From a Uint8Array input, create the blake2b and return the result as a hex string.
import { blake2bAsHex } from '@polkadot/util-crypto';
blake2bAsHex('abc') // => '0xba80a53f981c4d0d6a2797b69f12f6e94c212f14685ac4b74b12bb6fdbffa2d17d87c5392aab792dc252d5de4533cc9518d38aa8dbf1925ab92386edd4009923'
blake2bAsU8a
Creates a blake2b Uint8Array from the input.
blake2bAsU8a (value: Uint8Array): Uint8Array
From a Uint8Array input, create the blake2b and return the result as a Uint8Array.
import { blake2bAsU8a } from '@polkadot/util-crypto';
blake2bAsU8a('abc') // => Uint8Array('508c5e8c327c14e2e1a72ba34eeb452f37458b209ed63a294d999b4c86675982')