Package tlslite :: Package utils :: Module chacha :: Class ChaCha
[hide private]
[frames] | no frames]

Class ChaCha

source code


Pure python implementation of ChaCha cipher

Instance Methods [hide private]
 
__init__(self, key, nonce, counter=0, rounds=20)
Set the initial state for the ChaCha cipher
source code
 
decrypt(self, ciphertext)
Decrypt the data
source code
 
encrypt(self, plaintext)
Encrypt the data
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods [hide private]
 
_bytearray_to_words(data)
Convert a bytearray to array of word sized ints
source code
 
chacha_block(key, counter, nonce, rounds)
Generate a state of a single block
source code
 
double_round(x)
Perform two rounds of ChaCha cipher
source code
 
quarter_round(x, a, b, c, d)
Perform a ChaCha quarter round
source code
 
rotl32(v, c)
Rotate left a 32 bit integer v by c bits
source code
 
word_to_bytearray(state)
Convert state to little endian bytestream
source code
Class Variables [hide private]
  constants = [1634760805, 857760878, 2036477234, 1797285236]
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, key, nonce, counter=0, rounds=20)
(Constructor)

source code 

Set the initial state for the ChaCha cipher

Overrides: object.__init__