Class: Aes

Aes

AES (Rijndael cipher) encryption routines reference implementation, This is an annotated direct implementation of FIPS 197, without any optimisations. It is intended to aid understanding of the algorithm rather than for production use. While it could be used where performance is not critical, I would recommend using the ‘Web Cryptography API’ (developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/encrypt) for the browser, or the ‘crypto’ library (nodejs.org/api/crypto.html#crypto_class_cipher) in Node.js. See csrc.nist.gov/publications/fips/fips197/fips-197.pdf

Constructor

new Aes()

Source:

Methods

(private, static) addRoundKey()

Xor Round Key into state S [§5.1.4].
Source:

(static) cipher(input, w) → {Array.<number>}

AES Cipher function: encrypt 'input' state with Rijndael algorithm [§5.1]; applies Nr rounds (10/12/14) using key schedule w for 'add round key' stage.
Parameters:
Name Type Description
input Array.<number> 16-byte (128-bit) input state array.
w Array.<Array.<number>> Key schedule as 2D byte-array (Nr+1 × Nb bytes).
Source:
Returns:
Encrypted output state array.
Type
Array.<number>

(static) keyExpansion(key) → {Array.<Array.<number>>}

Perform key expansion to generate a key schedule from a cipher key [§5.2].
Parameters:
Name Type Description
key Array.<number> Cipher key as 16/24/32-byte array.
Source:
Returns:
Expanded key schedule as 2D byte-array (Nr+1 × Nb bytes).
Type
Array.<Array.<number>>

(private, static) mixColumns()

Combine bytes of each col of state S [§5.1.3].
Source:

(private, static) rotWord()

Rotate 4-byte word w left by one byte.
Source:

(private, static) shiftRows()

Shift row r of state S left by r bytes [§5.1.2].
Source:

(private, static) subBytes()

Apply SBox to state S [§5.1.1].
Source:

(private, static) subWord()

Apply SBox to 4-byte word w.
Source: