Integerating Block And A Stream Cipher Computer Science Essay

Published: Last Edited:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

In the world of digital data transaction, in order to transact the data in a more secured manner the need for a cryptographic algorithm cannot be compensated by others. There huge numbers of cryptographic algorithms which makes the system resistant from the attacks of intruders and eavesdroppers. RivestCipher4 and blow fish is one such cryptographic algorithm which is very well known for its performance, simplicity, strong key generation. In this paper, we propose a method of combining block and stream cipher for increasing the key strength so that it will be very hard for the intruder to break the key and intruder will have no idea about the key formation from the combination of block and stream cipher. So it will lead to increased key complexity which obviously results the intruder nothing else than confusion and frustration.

Keywords: Cryptography, Encryption, key strength, key complexity,blowfish,Rc4 algorithm.


Cryptography is a well known and widely used technique that manipulate information in order to crypt their existence. More speci¬cally, cryptography protects information by transforming it into an unreadable format [1]. The original text is transformed into a scramble equivalent text called cipher text and this process is called as "Encryption". This is achieved via an Encryption Algorithm. Only those who possess a secret key can decrypt the cipher text into plaintext. Simply it scrambles a message so it cannot be understood.

Cryptography deals with protecting information by encoding or transformation of data [1].There are two types of cryptographic schemes available on the basis of key.

Symmetric key Cryptography: This is the cryptographic scheme which uses a common key for enciphering and deciphering the message.

Asymmetric or Public Key Cryptography: This type of cryptographic scheme uses two keys for encryption and decryption called Public key and Private Keys.

We adopted Symmetric key cryptographic scheme and hence only one key is needed for communication. So, the chosen cryptographic scheme involves,

Plaintext: The original message that has to be communicated to receiver.

Encryption: Enciphering of data by using a key via a desired encryption algorithm at sender side.

Transmission: Transfer of cipher message to receiver through a public communication channel.

Decryption: Deciphering of the cipher text thus received via the same algorithm (reverse Encryption) by using the key.


Fig 1: Symmetric Key Cryptography

We can also classify symmetric key cryptography into two types on the basis of their operations as

Stream Ciphers: It is a symmetric key cipher where stream of plaintext are mixed with a random cipher bit stream (key stream), typically by any logical thie case of stream cipher one byte is usuallly encrypted at a particular time.

Block Ciphers: block cipher is also a symmetric key cipher which operates over a fixed-length groups of bits,. It usually take particular bit block of plaintext as input, and produces a corresponding n-bit output block of cipher text.

We have chosen block cipher for our cryptographic operation since it is the main tool for implementing private key encryption in practice.[1]



RC4 is a synchronous stream cipher designed to satisfy both security and efficiency for lightweight algorithms, dedicated to hardware. Environments where the available resources are restricted. RC4 stream ciphers have weaknesses on the key size. If the key size is short, attacker can easily obtain the key by using the key recovery algorithms. In this case, re-keying is necessary.[10] Generally, re-keying is done by using the internal state in each packet to reinitialize the large internal state. The newly initialized internal state is dependant; therefore more variation and randomness can be achieved for the internal state. The value of internal state must be unique, and must not be used twice or more although the messages to be encrypted are different. Stream cipher is the important class of encryption and they encrypt each digit of plain text one at a time using a simple time dependent encryption transformation in practice ,the digit is single bit or byteRc4 is most widely used stream cipher nowadays due to its simplicity and high efficiency .rc4 usually has varying key size and key size of stream cipher based on a 256 byte internal state and two one byte indexes I and j.rc4 consist of two parts namely key scheduling algorithm and pseudo random generation[2].

The key-scheduling algorithm consists of following steps in order to generate a key we should start the permutation in the array "S". "Key length" is stated as the number of bytes in the key and it usually range 1 ≤ key length ≤ 256, typically between 5 and 16, accordance to a key length of 40 - 128 bits. Initially, the array "S" is initialized to the recognized permutation.

for (i=0;i<=255;i++)

S[i] = I;

j = 0;

for (i=0;i <=255;i++)


j = (S[i] + i + key[i mod key length]) mod 256;

swap(S[i] , S[j]);


The Pseudo random generation algorithm changes the state and particular outputs a byte over the key stream. In each iteration, the PRGA increments i, adds the value of S pointed to by i to j.[3]

i = 0;

j = 0;



i = (i + 1) mod 256;

j = (j + S[i]) mod 256;

swap( S[i] , S[j] );

K = S[(S[i] + S[j]) mod 256];



Fig2:Rc4 stream generation

Blowfish Algorithm:

Blowfish, a symmetric block cipher and a Feistel network, iterating simple encryption and decryption functions of 16 times each. The strength of the Blowfish algorithm relies on its sub-key generation and its encryption. Blowfish is a block cipher which uses a variable-length key. It is well fitted for applications in which the key size does not change often. It is significantly faster than most encryption algorithms when implemented on 32-bit microprocessors with large data caches. [2]

Blowfish cipher uses 18 each of 32-bit sun arrays commonly known as P-boxes and four Substitution boxes each of 32 bit size and having 256 entries each. It uses a Feistel cipher which is a general method of transforming a function into an another function by using the concept of permutation.[3] The working of blowfish cipher can be illustrated as follows,

It splits the 64 bit block into two equal blocks having 32 bit size each. Lest block is XORed with first sub array P1 and thus obtained result is fed in to a function called F-function. Inside the F-function substitution operations are carried out which in turn converts 32 bit blocks in to an another 32 bit blocks. Thus resulted 32bit entries are XORed with the Right half and the result obtained is swapped as the left half for the next round. So, After the successful completion of each round Right half becomes the new left half or vice versa and Fiestal structure is followed up to 16 rounds. The resultant left and right halves are not swapped but XORed with the seventeenth and eighteenth P-arrays. The Fiestal Structure of blowfish algorithm is shown in the Fig-2

Figure 2: Fiestal structure of Blowfish Cipher

The transformation operations that actually happen inside an F-function are XOR Operation, ADD Operation and few table look up operations. These operations are carried out between four S-Boxes and as a result of all manipulations finally 32 bit entries are transformed into another 32 bit entry.


In this paper we propose a new system of integration of the Block and the Stream cipher for generating a fresh key from the actual key provided by the user. The fresh key thus obtained is hard to crack because it involves addition of the complexity from the block cipher to the key. In general numerous cryptographic block ciphers are available such as blow fish, Two fish, AES block which were all known for its security and complexity. For our publication purpose we propose blowfish and RC4 integration for the generation of the strong key. The following block diagram illustrates our modified approach of integration of blowfish and Rivestcipher4 algorithm.

Fig 3: Block diagram of Encryption phase

Fig4 : Block diagram of encryption phase

The significance of the proposed systems are as follows:

The Rc4 is enhanced both in terms of keystrength and its complexity.The newly formed key which is generated will not be known even to sender and receiver

In general, Key strength which is one of the salient feature of block cipher which is missing in all stream ciphers. This scenario will come to an end by the usage of blowfish which is a block cipher and it will increase the key strength that is ever provided by other stream ciphers.

Since blow fish execution is independent of the original RC4 algorithm, there is no chance for affecting the data security of RC4 algorithm.

We propose this blowfish inorder to increase the key strength so that it will be suitable in the mere future to hold any algorithm like RC4 which lags in their key strength.


For the purpose of simulating the blowfish and RC4 algorithm we used Java which is known for its platform independency and better GUI features. The following figures illustrates about the encryption and decryption phase of Rc4 algorithms.

Fig 5:Rc4 Encryption

Fig 6: RC4 Decryption.


The integration of the blowfish and Rc4 can be easily modified to accept any encryption algorithm which is framed in future. Just by adding or removing another module in the main function and also by increasing or decreasing the hash limit, any number of iteration can be included or reduced in the particular algorithm or other in particular they are used to increase the key length especially in the case of RC4[9]. Though the system is designed for stream cipher but the modules can be used in block cipher also in which key length is already in high complexity. By adding a new authentication between the sender and receiver sockets, the system can also be improved to work as secure WAP and WLAN. Moreover, we currently concentrate on our next work which is a Iterative method inorder to increase the key strength of RC4.


Key strength of RC4 has the main concern of security weakness , so that they can be easily breached, the tool that we developed is used to increase the complexity of the key .The intruder will have no idea about the existence of the particular block cipher in our case we have blow fish which is the strongest block cipher and before his realization of existence of block cipher for key generation particular data will be transferred to the receiver. Thus the integration of block and stream cipher that is being implemented will increase the key complexity without affecting the performance up to a maximum level that ever offered by the existing stream ciphers. Thus a rc4 will be increased in both security and performance.