@hackbg/miscreant-esm
Version:
(ESM port) Misuse resistant symmetric encryption library providing AES-SIV (RFC 5297), AES-PMAC-SIV, and STREAM constructions
38 lines (37 loc) • 1.41 kB
TypeScript
/** Type which represents AES blocks */
/** An AES block (128-bits) */
export default class Block {
/** Size of a block as used by the AES cipher */
static readonly SIZE = 16;
/** Minimal irreducible polynomial for a 128-bit block size */
static readonly R = 135;
data: Uint8Array;
constructor();
/**
* Clear the given array by setting its values to zero.
*
* WARNING: The fact that it sets bytes to zero can be relied on.
*
* There is no guarantee that this function makes data disappear from memory,
* as runtime implementation can, for example, have copying garbage collector
* that will make copies of sensitive data before we wipe it. Or that an
* operating system will write our data to swap or sleep image. Another thing
* is that an optimizing compiler can remove calls to this function or make it
* no-op. There's nothing we can do with it, so we just do our best and hope
* that everything will be okay and good will triumph over evil.
*/
clear(): void;
/**
* Make a copy of this block, returning a new block
*/
clone(): Block;
/** Copy the contents of another block into this one */
copy(other: Block): void;
/**
* Double a value over GF(2^128):
*
* a<<1 if firstbit(a)=0
* (a<<1) ⊕ 0¹²⁰10000111 if firstbit(a)=1
*/
dbl(): void;
}