Algorithm Description


1) Key Algorithm

The Key is used to generate 256 N-bit subkeys, where N is the block size. The stages involved in generating these subkeys are as follows:

  1. The key is input, byte-by-byte (treated as a big-endian byte array), into a cryptographically strong Pseudo Random Number Generator (PRNG). In particular, in this implementation, the randpool generator (provided with CryptoPP 5.0) is employed.
  2. 256 n-bit subkeys are generated, byte-by-byte, and stored in 256 big-endian byte arrays.
  3. An 8X8 S-Box is generated as follows:
    • start with the identity S-Box
    • for i = 1 to 256 do
      	j = subkey[i] (mod (256-i))
      	swap s[i] and s[j]
      			
  4. For the first round, subkeys 0, 64, 128, and 192 will be used as the designated subkeys. Each round, each number will be incremented by one (mod 256).
  5. After each 256 rounds (however many blocks that takes), the Key will be put through one round of encryption, and then used to generate a new set of subkeys (in exactly the same way as done above).

2) Round Algorithm

In each round, the following steps occur in order:

  1. The block (treated as a big-endian byte array) is XORed with designated subkey 1.
  2. The block is put through an array of S-Boxes.
  3. The block is put through a permutation defined by subkey 2. This permutation is as follows:
    1. Start with the two counters, set to 1 and N.
    2. For each bit in the subkey in turn (starting at the most significant bit),
      1. If that bit is a 1, take the first number from the first counter and insert it at the end of an array. Increment the first counter.
      2. If that bit is a 0, take the first number from the second counter and insert it at the end of an array. Decrement the second counter.
    3. Once the array has been produced, for each bit i in the block (starting at the most significant bit), put it in position a[i], where a[i] is the i-th number in the array.
  4. The block is put through an array of S-Boxes.
  5. The block is put through a permutation defined by subkey 3. This is the same as the previous permutation, except that the block is put through the array, bit-by-bit, starting at the least significant bit.
  6. The block is XORed with designated subkey 4.

That's it. Good luck.


Page last updated February 26, 2008

All content on this page, including downloadable content, is © 2001-2008 by Brian York.

Web page built using BBEdit 8.7.