Files
common/packages/util-crypto/docs/blake2s.md
T
Jaco Greeff b5c5734c7c Add Blake2s & XXHash utility functions (#66)
* Initial split of util & util-crypto

* Add initial XXHash version

* Blake2s wit tests & documentation

* Add sha512 (from NaCl)

* Add randomBytes (from NaCl)

* Flow fixes

* Update documentation

* Update latest @polkadot/dev
2018-01-25 14:13:43 +01:00

1.4 KiB

blake2s

Create Blake2s values as hex, Buffer & Uint8Array output

blake2sAsBuffer

Creates a blake2s Buffer from the input.

blake2sAsBuffer (value: Uint8Array): Buffer

From a Uint8Array input, create the blake2s and return the result as a Buffer.

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

blake2sAsBuffer('abc') // => Buffer.from('508c5e8c327c14e2e1a72ba34eeb452f37458b209ed63a294d999b4c86675982', 'hex')

blake2sAsHex

Creates a blake2s hex string from the input.

blake2sAsHex (value: Uint8Array): string

From a Uint8Array input, create the blake2s and return the result as a hex string.

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

blake2sAsHex('abc') // => '0x508c5e8c327c14e2e1a72ba34eeb452f37458b209ed63a294d999b4c86675982'

blake2sAsU8a

Creates a blake2s Uint8Array from the input.

blake2sAsU8a (value: Uint8Array): Uint8Array

From a Uint8Array input, create the blake2s and return the result as a Uint8Array.

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

blake2sAsU8a('abc') // => Uint8Array('508c5e8c327c14e2e1a72ba34eeb452f37458b209ed63a294d999b4c86675982')