UNPKG

@hackbg/miscreant-esm

Version:

(ESM port) Misuse resistant symmetric encryption library providing AES-SIV (RFC 5297), AES-PMAC-SIV, and STREAM constructions

28 lines (27 loc) 1.07 kB
/** * NOTE! Due to the inability to guarantee real constant time evaluation of * anything in JavaScript VM, this is module is the best effort. */ /** * Returns resultIfOne if subject is 1, or resultIfZero if subject is 0. * * Supports only 32-bit integers, so resultIfOne or resultIfZero are not * integers, they'll be converted to them with bitwise operations. */ export declare function select(subject: number, resultIfOne: number, resultIfZero: number): number; /** * Returns 1 if a and b are of equal length and their contents * are equal, or 0 otherwise. * * Note that unlike in equal(), zero-length inputs are considered * the same, so this function will return 1. */ export declare function compare(a: Uint8Array, b: Uint8Array): number; /** * Returns true if a and b are of equal non-zero length, * and their contents are equal, or false otherwise. * * Note that unlike in compare() zero-length inputs are considered * _not_ equal, so this function will return false. */ export declare function equal(a: Uint8Array, b: Uint8Array): boolean;