tlslite.utils.chacha module¶
Pure Python implementation of ChaCha cipher
Implementation that follows RFC 7539 closely.
-
class
tlslite.utils.chacha.
ChaCha
(key, nonce, counter=0, rounds=20)¶ Bases:
object
Pure python implementation of ChaCha cipher
-
__init__
(key, nonce, counter=0, rounds=20)¶ Set the initial state for the ChaCha cipher
-
static
chacha_block
(key, counter, nonce, rounds)¶ Generate a state of a single block
-
constants
= [1634760805, 857760878, 2036477234, 1797285236]¶
-
decrypt
(ciphertext)¶ Decrypt the data
-
classmethod
double_round
(x)¶ Perform two rounds of ChaCha cipher
-
encrypt
(plaintext)¶ Encrypt the data
-
static
quarter_round
(x, a, b, c, d)¶ Perform a ChaCha quarter round
-
static
rotl32
(v, c)¶ Rotate left a 32 bit integer v by c bits
-
static
word_to_bytearray
(state)¶ Convert state to little endian bytestream
-