Crypto
Cryptographic utilities for Dapps.
Install
First, we will install @w3ux/crypto
as a dependency in our project.
npm
npm i @w3ux/crypto
blake2AsU8a
Creates a BLAKE2b hash of the input data and returns it as a Uint8Array
.
@param {Uint8Array | string | Buffer} data
The input data to hash, as astring
,Uint8Array
, orBuffer
.@param (number?) bitLength
- The bit length of the hash output (default 256).@returns Uint8Array
The BLAKE2b hash output as a Uint8Array.
const result = blake2AsU8a(new Uint8Array(32));