Methods
(static) decrypt(ciphertext, password, nBits) → {string}
Decrypt a text encrypted by AES in counter mode of operation
Parameters:
Name | Type | Description |
---|---|---|
ciphertext |
string | Cipher text to be decrypted. |
password |
string | Password to use to generate a key for decryption. |
nBits |
number | Number of bits to be used in the key; 128 / 192 / 256. |
- Source:
Returns:
Decrypted text
- Type
- string
Example
const decr = AesCtr.decrypt('lwGl66VVwVObKIr6of8HVqJr', 'pāşšŵōřđ', 256); // 'big secret'
(static) encrypt(plaintext, password, nBits) → {string}
Encrypt a text using AES encryption in Counter mode of operation.
Unicode multi-byte character safe
Parameters:
Name | Type | Description |
---|---|---|
plaintext |
string | Source text to be encrypted. |
password |
string | The password to use to generate a key for encryption. |
nBits |
number | Number of bits to be used in the key; 128 / 192 / 256. |
- Source:
Returns:
Encrypted text.
- Type
- string
Example
const encr = AesCtr.encrypt('big secret', 'pāşšŵōřđ', 256); // 'lwGl66VVwVObKIr6of8HVqJr'
(static) utf8Decode()
Decodes utf8 string to multi-byte.
- Source:
(static) utf8Encode()
Encodes multi-byte string to utf8.
Note utf8Encode is an identity function with 7-bit ascii strings, but not with 8-bit strings;
utf8Encode('x') = 'x', but utf8Encode('ça') = 'ça', and utf8Encode('ça') = 'ça'.
- Source: