Package Cryptodome :: Package Cipher :: Module Salsa20 :: Class Salsa20Cipher

Class Salsa20Cipher

Salsa20 cipher object
Instance Methods
 
__init__(self, key, nonce)
Initialize a Salsa20 cipher object
 
encrypt(self, plaintext)
Encrypt a piece of data.
 
decrypt(self, ciphertext)
Decrypt a piece of data.
Instance Variables
  nonce
Nonce
Method Details

__init__(self, key, nonce)
(Constructor)

 

Initialize a Salsa20 cipher object

See also new() at the module level.

encrypt(self, plaintext)

 
Encrypt a piece of data.
Parameters:
  • plaintext (byte string) - The piece of data to encrypt. It can be of any size.
Returns:
the encrypted data (byte string, as long as the plaintext).

decrypt(self, ciphertext)

 
Decrypt a piece of data.
Parameters:
  • ciphertext (byte string) - The piece of data to decrypt. It can be of any size.
Returns:
the decrypted data (byte string, as long as the ciphertext).