Members
(static, constant) name
The name of the mode.
Methods
(static) decrypt(prf, ciphertext, iv, adataopt)
Decrypt in CTR mode.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
prf |
Object | The pseudorandom function. It must have a block size of 16 bytes. | ||
ciphertext |
bitArray | The ciphertext data. | ||
iv |
bitArray | The initialization value. It must be 128 bits. | ||
adata |
bitArray |
<optional> |
[] | The authenticated data. It must be empty. |
Throws:
-
-
if the IV isn't exactly 128 bits or if any adata is specified.
-
-
-
if if the message is corrupt.
-
Returns:
The decrypted data, an array of bytes.
(static) encrypt(prf, plaintext, iv, adataopt)
Encrypt in CTR mode.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
prf |
Object | The pseudorandom function. It must have a block size of 16 bytes. | ||
plaintext |
bitArray | The plaintext data. | ||
iv |
bitArray | The initialization value. It must be 128 bits. | ||
adata |
bitArray |
<optional> |
[] | The authenticated data. Must be empty. |
Throws:
-
if the IV isn't exactly 128 bits or if any adata is specified.
Returns:
The encrypted data, an array of bytes.