Chacha20 Algorithms - 2023.2 English

Vitis Libraries

Release Date
2023-12-20
Version
2023.2 English

Chacha20 is a cipher stream. Its input includes a 256-bit key, a 32-bit counter, a 96-bit nonce and plain text. Its initial state is a 4*4 matrix of 32-bit words. The first row is a constant string “expand 32-byte k” which is cut into 4*32-bit words. The second and the third are filled with 256-bit key. The first word in the last row are 32-bit counter and the others are 96-bit nonce. It generate 512-bit keystream in each iteration to encrypt a 512-bit bolck of plain text. When the rest of plain text is less 512 bits after many times encryption, please padding to the left with 0s(MSB) in the last input data and remove the same bits unuseful data from the last output data. Its encryption and decryption are same as long as input same initial key, counter and nonce.

XChacha20 is a variant of original Chacha20 to support Longer nonce of 192bits. Its implementation is similar to Chacha20.

Initial state of chacha20