Cipher class function
The cipher class is intended for integrators familiar with basic crypto concepts.
Function | Description | Sample |
---|---|---|
nevis.crypto.cipher.new(mode, algorithm, key, IV) | Instantiate a new crypto cipher object with the following options:mode: ENCRYPT | DECRYPTalgorithm: Blowfish, DES, DESede, RC4, AES and AES/GCMkey: Key for encryption/decryptionIV: Initialization Value for encryption/decryption. |
Both key and IV are 16 bytes long, except for AES/GCM, where the key is 32, and the IV is 12 bytes long. Longer values are truncated, shorter values are extended with "@" characters up to 16 bytes.
They are interpreted as an ASCII string (1 byte per character), but they are not limited to ASCII characters.
For non-ASCII values, use \x00 - \xFF.
There are no default values for IV or key, both of them have to be given during object instantiation.
We recommend you use unique random IVs per encryption.