UNPKG

929 BTypeScriptView Raw
1import type { HexString } from '@polkadot/util/types';
2declare type BitLength = 64 | 128 | 256 | 384 | 512;
3/**
4 * @name blake2AsU8a
5 * @summary Creates a blake2b u8a from the input.
6 * @description
7 * From a `Uint8Array` input, create the blake2b and return the result as a u8a with the specified `bitLength`.
8 * @example
9 * <BR>
10 *
11 * ```javascript
12 * import { blake2AsU8a } from '@polkadot/util-crypto';
13 *
14 * blake2AsU8a('abc'); // => [0xba, 0x80, 0xa5, 0x3f, 0x98, 0x1c, 0x4d, 0x0d]
15 * ```
16 */
17export declare function blake2AsU8a(data: HexString | Uint8Array | string, bitLength?: BitLength, key?: Uint8Array | null, onlyJs?: boolean): Uint8Array;
18/**
19 * @name blake2AsHex
20 * @description Creates a blake2b hex from the input.
21 */
22export declare const blake2AsHex: (data: string | Uint8Array, bitLength?: BitLength | undefined, key?: Uint8Array | null | undefined, onlyJs?: boolean | undefined) => `0x${string}`;
23export {};