UNPKG

@li0ard/streebog

Version:

Streebog hash function in pure TypeScript

36 lines (35 loc) 1.51 kB
/** XOR two Uint8Array arrays */ export declare const xor: (a: Uint8Array, b: Uint8Array) => Uint8Array<ArrayBuffer>; /** Addition of two 512 bit numbers */ export declare const add512: (a: Uint8Array, b: Uint8Array) => Uint8Array; /** * `S`-transformation. * The `S` function is a regular substitution function. Each byte of the * 512-bit input sequence is replaced by the corresponding byte from * the `PI` substitution table. */ export declare const transformS: (input: Uint8Array) => Uint8Array; /** * `P`-transformation. * Permutation function. For each pair of bytes from the input sequence, * one byte is replaced by another. */ export declare const transformP: (input: Uint8Array) => Uint8Array; /** * `L`-transformation. * Represents the multiplication of a 64-bit input vector by a 64x64 binary matrix `A`. */ export declare const transformL: (input: Uint8Array) => Uint8Array; /** * `E`-transformation. * Part of compression function. */ export declare const transformE: (block: Uint8Array, keys: Uint8Array) => Uint8Array; /** Compression function `G` aka XSPLEXX-algorithm */ export declare const transformG: (hash: Uint8Array, n: Uint8Array, message: Uint8Array) => Uint8Array; /** Convert hex to bytes */ export declare function hexToBytes(hex: string): Uint8Array; /** Convert number to bytes (Big-Endian) */ export declare function numberToBytesBE(n: number | bigint, len: number): Uint8Array; /** Padding for blocks */ export declare const pad: (data: Uint8Array) => Uint8Array;