UNPKG

@li0ard/gost341194

Version:

GOST R 34.11-94 hash function in pure TypeScript

40 lines (39 loc) 1.4 kB
import { type Sbox } from "@li0ard/magma"; import { type Hash, type TArg, type TRet } from "@noble/hashes/utils.js"; /** GOST R 34.11-94 class */ export declare class Gost341194 implements Hash<Gost341194> { private data; private sbox; readonly blockLen: number; readonly outputLen = 32; readonly canXOF = false; /** * GOST R 34.11-94 constructor * @param data Data to be hashed (optional, can be updated using `update` method) * @param sbox S-Box (optional, default is `ID_GOSTR_3411_94_CRYPTOPRO_PARAM_SET`) */ constructor(data?: TArg<Uint8Array>, sbox?: Sbox); /** Create hash instance */ static create(): Gost341194; /** Reset hash state */ destroy(): void; /** Clone hash instance */ clone(): Gost341194; _cloneInto(to?: Gost341194): Gost341194; /** Update hash buffer */ update(data: TArg<Uint8Array>): this; /** * Finalize hash computation and write result into Uint8Array * @param buf Output Uint8Array */ digestInto(buf: TArg<Uint8Array>): void; /** Finalize hash computation and return result as Uint8Array */ digest(): TRet<Uint8Array>; } /** * Compute hash with GOST R 34.11-94 * @param input Input bytes */ export declare const gost341194: (input: TArg<Uint8Array>, sbox?: Sbox) => TRet<Uint8Array>; export { sboxes } from "./const.js"; export * from "./pbkdf2.js";