@li0ard/gost3413
Version:
Cipher modes and padding's according to GOST R 34.13-2015 in pure TypeScript
28 lines (27 loc) • 1.08 kB
TypeScript
/** Type for cipher function */
export type CipherFunc = (data: Uint8Array) => Uint8Array;
/** Key size */
export declare const KEYSIZE = 32;
/** ACPKM class */
export interface ACPKMClass {
/** Encrypting function, that takes block as input */
encrypt(block: Uint8Array): Uint8Array;
}
/** ACPKM class constructor */
export interface ACPKMConstructor {
new (key: Uint8Array): ACPKMClass;
}
/** ACPKM Parameters */
export interface ACPKMParameters {
/** ACPKM cipher class */
cipherClass: ACPKMConstructor;
/** ACPKM section size (N) */
sectionSize: number;
}
export declare const xor: (a: Uint8Array, b: Uint8Array) => Uint8Array<ArrayBuffer>;
export declare function concatBytes(...arrays: Uint8Array[]): Uint8Array;
export declare function hexToBytes(hex: string): Uint8Array;
export declare function bytesToHex(bytes: Uint8Array): string;
export declare function numberToBytesBE(n: number | bigint, len: number): Uint8Array;
export declare function hexToNumber(hex: string): bigint;
export declare function bytesToNumberBE(bytes: Uint8Array): bigint;