UNPKG

mina-attestations

Version:
26 lines (25 loc) 930 B
import { Bytes, UInt8 } from 'o1js'; import { DynamicArray } from './dynamic-array.ts'; export { DynamicSHA3 }; declare const DynamicSHA3: { /** * Hash a dynamic-length byte array using the Ethereum-compatible Keccak-256 hash. * * Primarily used in Ethereum for hashing transactions, messages, and other types of payloads. * * The input type `DynamicArray<UInt8>` is compatible with both `DynamicString` and `DynamicBytes`: * * ```ts * // using DynamicString * const String = DynamicString({ maxLength: 120 }); * let string = String.from('hello'); * let hash = DynamicSHA3.keccak256(string); * * // using DynamicBytes * const Bytes = DynamicBytes({ maxLength: 120 }); * let bytes = Bytes.fromHex('010203'); * let hash = DynamicSHA3.keccak256(bytes); * ``` */ keccak256(message: DynamicArray<UInt8> | Uint8Array | string): Bytes; };