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__

Class Methods [hide private]
 
double_round(cls, x)
Perform two rounds of ChaCha cipher
source code
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
 
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]
  _round_mixup_box = [(0, 4, 8, 12), (1, 5, 9, 13), (2, 6, 10, 1...
  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__

Class Variable Details [hide private]

_round_mixup_box

Value:
[(0, 4, 8, 12),
 (1, 5, 9, 13),
 (2, 6, 10, 14),
 (3, 7, 11, 15),
 (0, 5, 10, 15),
 (1, 6, 11, 12),
 (2, 7, 8, 13),
 (3, 4, 9, 14)]