UNPKG

947 BTypeScriptView Raw
1/// <reference types="node" />
2import type { HexString } from '@polkadot/util/types';
3declare type BitLength = 64 | 128 | 192 | 256 | 320 | 384 | 448 | 512;
4/**
5 * @name xxhashAsU8a
6 * @summary Creates a xxhash64 u8a from the input.
7 * @description
8 * From either a `string`, `Uint8Array` or a `Buffer` input, create the xxhash64 and return the result as a `Uint8Array` with the specified `bitLength`.
9 * @example
10 * <BR>
11 *
12 * ```javascript
13 * import { xxhashAsU8a } from '@polkadot/util-crypto';
14 *
15 * xxhashAsU8a('abc'); // => 0x44bc2cf5ad770999
16 * ```
17 */
18export declare function xxhashAsU8a(data: HexString | Buffer | Uint8Array | string, bitLength?: BitLength, onlyJs?: boolean): Uint8Array;
19/**
20 * @name xxhashAsHex
21 * @description Creates a xxhash64 hex from the input.
22 */
23export declare const xxhashAsHex: (data: string | Uint8Array | Buffer, bitLength?: BitLength | undefined, onlyJs?: boolean | undefined) => `0x${string}`;
24export {};