BUGS OVERVIEW

>> FULL DOCUMENTATION AVAILABLE HERE <<

The BUGS Cipher has two main cryptographic primitives, a Key Scheduler and a symmetric-key encryption function.

It uses an Initialisation Vector (IV) to dynamically change the behaviour of both primitives. It is a highly configurable cipher where the user can decides different default settings which can also be set to dynamically change. For example, the number of round is set to two by default, but it is possible to specify a different value on execution, i.e. R=5. We can also allow or not the algorithm to dynamically change that base value depending of the IV.

The key scheduler is designed to extend or stretch the key. In the symmetric-key encryption function, it is used to generate key buffers in an attempt to diffuse repetition.

The symmetric-key encryption function has two sub-functions, only referred from then on as encryption functions; they can be used independently or combined one after the other. The first of those encryption functions is similar to a block cipher used in a stream cipher mode while the second is similar to a chain block cipher.

Key Scheduler
The Key scheduler has three Phases: Initialisation, Scrambling and Randomisation.

The initialisation phase requires an Initialisation Vector (IV) and the size Ns of the subkey the user wants to generate. The IV can either be an initial key or a random number both of size Ni such as Ns/2 <= Ni <= Ns

  • It starts by padding the IV if required to the size Ns
  • It concatenates the bytes together
  • It generates a pseudo random number (PRN1) by combing all the IV bytes together with a XOR
  • It adds a different derived PRN1 to each IV bytes
  • It defines a number of variables:
      Operation, O (Swap or Logical Ops) = byte1
      Direction, D (Left or Right) = byte2
      Modulo size, M0 (Big or Small) = byte3
      Nb or Round, R (max x2 value specified by user) = byte4
  • This process generates the first subkey, SK1

    The main part of the key scheduler is the scrambling phase. Using SK1:

  • It generates a session modulo, Ms = byte1 ⊕ byte2 % M0
  • It generates a Shift Window, SW = byte1 % Ms
  • Depending of the value of D, the following may start from the beginning or the end of SK1
  • Between the Starting bit, i, and i + SW do an operation on those 2 bits.
  • The operation will depend of the value of O and can be a bit swapping or a choice of 5 logical operations
  • Change the value of the modulo M0 from small to big and vice versa.
  • Change the value of the operation O from a swap to a logical op and vice versa.
  • Change the direction D from left to right and vice versa
  • Repeat for R number of round
  • This process generates the second subkey, SK2

    The last part of the key scheduler is the randomisation phase. Using SK2:

  • It Generates a Random key, RND, either using the system random generator or the ISAAC algorithm [ ].
  • Using byte1 to select the index i, then bytei = bytei ⊕ RND
  • It uses a Linear Feedback Shift Register on RND to generate a new RND value
  • XOR than new RND value to another byte
  • Repeat the previous two points until all bytes have been “randomized”
  • The result is the key scheduler’s output, the encryption Key Ke

    Symmetric-Key encryption function
    It consists of an Initialisation phase and two Encryption functions: Seeding and Shuffling. It can operate in different modes where the encryption process uses one or both of the encryption functions. If using both, then the seeding phase is done first and the resulting seeded ciphertext is used as an input into the shuffling phase.

    The Initialisation phase consists of the following:

  • It breaks the plaintext into blocks of size defined by the user. The block size can be as large as the plaintext itself of a multiple of the key size used for the encryption.
  • An IV is used to define the key buffer size, S (with a minimum of 16)
  • A random number, RN, is generated for the encryption, XORed with a key and inserted in a pseudo random position into the final cipher text.
  • The Seeding phase is similar to a Block cipher used in a Stream cipher mode where a keystream is applied to the plaintext blocks in a pseudo random sequence.

  • It uses the Key Scheduler to generate S number of encryption keys, Kei, and stores the keys into a Key Buffer table, KT
  • It pseudo randomly chooses two encryption keys from KT and by XORing them it generates a new encryption key, Keseed, which is then XORed with a pseudo randomly chosen plaintext block, then labelled as “seeded”.
  • Keseed is then used as an IV into the key scheduler to generate a new Kei and replace one of the two encryption key used above into KT
  • The process is repeated until all the plaintext blocks have been encrypted with a XOR, the result is a Seeded Cipher text, sC.
  • The Shuffling phase is similar to a Chain Block Cipher as described below.

  • It pseudo randomly chooses two plaintext block and by XORing them it generates a new encryption key, Keshuffle, which is then XORed with another pseudo randomly chosen plaintext block. That latest plaintext block is labelled as “shuffled”.
  • That process is then repeated with:
      One of the plaintext blocks used to create Keshuffle is selected as the next block to be encrypted
      Once a plaintext block has been shuffled it cannot be used to generate a new Keshuffle
      And until all the plaintext blocks have been encrypted but two.
  • Two blocks must remain “unshuffled” to be able for the recipient to reverse the encryption process. They will therefore simply be XORED with a key of the form Keseed as defined previously.
  • The result is a Cipher shuffled text, Cs.
  • >> FULL DOCUMENTATION IS AVAILABLE HERE <<