35 lines
959 B
TypeScript
35 lines
959 B
TypeScript
/**
|
|
* Cryptographic hashing functions
|
|
*
|
|
* @_subsection: api/crypto:Hash Functions [about-crypto-hashing]
|
|
*/
|
|
import type { BytesLike } from "../utils/index.js";
|
|
/**
|
|
* Compute the cryptographic KECCAK256 hash of %%data%%.
|
|
*
|
|
* The %%data%% **must** be a data representation, to compute the
|
|
* hash of UTF-8 data use the [[id]] function.
|
|
*
|
|
* @returns DataHexstring
|
|
* @example:
|
|
* keccak256("0x")
|
|
* //_result:
|
|
*
|
|
* keccak256("0x1337")
|
|
* //_result:
|
|
*
|
|
* keccak256(new Uint8Array([ 0x13, 0x37 ]))
|
|
* //_result:
|
|
*
|
|
* // Strings are assumed to be DataHexString, otherwise it will
|
|
* // throw. To hash UTF-8 data, see the note above.
|
|
* keccak256("Hello World")
|
|
* //_error:
|
|
*/
|
|
export declare function keccak256(_data: BytesLike): string;
|
|
export declare namespace keccak256 {
|
|
var _: (data: Uint8Array) => Uint8Array;
|
|
var lock: () => void;
|
|
var register: (func: (data: Uint8Array) => BytesLike) => void;
|
|
}
|