Improve explanation of the XXTEA algorithm

This commit is contained in:
Juhani Krekelä 2021-04-08 20:43:16 +03:00
parent 21ed995281
commit d4ed30a592
1 changed files with 11 additions and 9 deletions

20
puer.c
View File

@ -25,16 +25,18 @@ void xxtea128(uint32_t const key[4], uint32_t block[4]) {
// key accesses, since key is only 4 words long
//
// 3. Go through each word in the block and derive its new
// value based on next (y) and previous word (z),
// wrapping around as needed, as well as the round
// constant(s) and the key.
// value based on its current value (v[p]), the next (y)
// and the previous word (z), wrapping around the ends
// of the block as needed.
//
// The function for deriving the new value of a block is a
// xor of sums of xors. The first sum adds together
// combinations of the next and previous block, and the
// second sum adds together previous/bext combined with a
// value dependant on the round constant. The key is also
// mixed into the block in the first xor of second sum.
// The function for deriving the new value of a word is a
// xor of sums of xors, followed by an in-place addition.
// The first sum adds together combinations of the next and
// previous word, and the second sum adds together
// previous/next combined with a value dependant on the
// round constant. The key is also mixed into the word in
// the first xor of second sum. After this the result is
// added back into the original word.
//
// I have changed the operand order in the second xor of
// first add and in the second add. This is to keep the