Namespace: ctr

sjcl.mode.ctr

Dangerous: CTR mode.
Author:
  • Torben Haase
Source:

Members

(static, constant) name

The name of the mode.
Source:

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.
Source:
Throws:
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.
Source:
Throws:
if the IV isn't exactly 128 bits or if any adata is specified.
Type
sjcl.exception.invalid
Returns:
The encrypted data, an array of bytes.