Encrypting the Data

The two stages of encryption are identical. For each stage of the 2-stage encryption the following notation is used (the subscript i corresponds to the i th character from the plain language message):

C_{i} = the ASCII value of the i th enciphered character;

R_{i} = the value of the index register element used for encrypting or decrypting the ith character

R( j) = the value of the j th element of the index register;

S( j) = the j th element of the shift register;

S_{i} = the value of S(1) for the i th character;

P_{i} = the ASCII value of the i th plaintext character.

For the first stage of encryption, the first encryption is represented by C_{i}, while for the second stage, the first encryption is represented by P_{i}. The encryption process begins by using a bitwise XOR function to combine the ASCII value of each plain language character in turn with the contents of the appropriate element of the index register, indicated by the value of S_{i} :

This produces the enciphered character, C_{i}. The XOR function is also used to combine the same plain language character with the contents of S_{i}, the result of which is added to the shift register as the next value of S(256)_{i+1}, after a SHIFT RIGHT LOGICAL operation on the shift register. The value of S_{i} used for the encryption is overwritten and cannot be recovered:

In practise, if there were a large number of repeated identical characters in the plain language text, a pattern would emerge in the output. The pattern could be used to identify the keys, if the repeating character can be discovered. Therefore an additional step is incorporated whereby a PRNG generates a random number between 0 and 255 to be combined with the result of Equation (3)

where R_{i} is the random number. Thus *S _{i}* is a number used once only (nonce). The random number generator seed does not need to be secure because its only function is to mask the effect of repeated characters.

The purpose of the shift register process is to ensure there is no traceable connection between *S*(256)_{i+1} and the enciphered character *C _{i}*. The whole encryption process is illustrated by Figure 6.

Figure 6: Details of the encryption process