UNPKG

mina-attestations

Version:
53 lines (52 loc) 2.35 kB
import { Bytes, UInt32, UInt64, UInt8 } from 'o1js'; export { SHA2 }; type FlexibleBytes = Bytes | (UInt8 | bigint | number)[] | Uint8Array | string; type Length = 224 | 256 | 384 | 512; declare const SHA2: { hash: typeof hash; padding256: typeof padding256; padding512: typeof padding512; initialState256: typeof initialState256; initialState512: typeof initialState512; messageSchedule256: typeof messageSchedule256; messageSchedule512: typeof messageSchedule512; compression256: typeof compression256; compression512: typeof compression512; }; declare function hash(len: Length, data: FlexibleBytes): import("node_modules/o1js/dist/node/lib/provable/bytes.js").Bytes; declare function initialState256(len: 224 | 256): UInt32[]; declare function initialState512(len: 384 | 512): UInt64[]; /** * Performs the SHA-256 compression function on the given hash values and message schedule. * * @param H - The initial or intermediate hash values (8-element array of UInt32). * @param W - The message schedule (64-element array of UInt32). * * @returns The updated intermediate hash values after compression. */ declare function compression256([...H]: UInt32[], W: UInt32[]): UInt32[]; /** * Performs the SHA-512 compression function on the given hash values and message schedule. * * @param H - The initial or intermediate hash values (8-element array of UInt64). * @param W - The message schedule (80-element array of UInt64). * * @returns The updated intermediate hash values after compression. */ declare function compression512([...H]: UInt64[], W: UInt64[]): UInt64[]; /** * Prepares the message schedule for the SHA-256 compression function from the given message block. * * @param M - The 512-bit message block (16-element array of UInt32). * @returns The message schedule (64-element array of UInt32). */ declare function messageSchedule256(M: UInt32[]): UInt32[]; /** * Prepares the message schedule for the SHA-512 compression function from the given message block. * * @param M - The 1024-bit message block (16-element array of UInt64). * @returns The message schedule (80-element array of UInt64). */ declare function messageSchedule512(M: UInt64[]): UInt64[]; declare function padding256(data: FlexibleBytes): UInt32[][]; declare function padding512(data: FlexibleBytes): UInt64[][];