Question

In: Computer Science

List the primitive operations used in the RC4 stream cipher algorithm for A) Key Stream Generation...

List the primitive operations used in the RC4 stream cipher algorithm for

A) Key Stream Generation

B) Bit Stream Encryption

Solutions

Expert Solution

A)RC4 is a stream cipher and variable length key algorithm. This calculation encodes each byte in turn (or bigger units on a period). A key information is pseudorandom bit generator that creates a stream 8-bit number that is erratic without information on input key, The yield of the generator is called key-stream, is joined each byte in turn with the plaintext stream cipher utilizing X-OR activity.

Example:

RC4 Encryption

10011000 ? 01010000=11001000

RC4 Decryption

11001000 ? 01010000=10011000

11001000 ? 01010000 = 10011000

Key-Generation Algorithm –A variable-length key from 1 to 256 byte is utilized to introduce a 256-byte state vector S, with components S[0] to S[255]. For encryption and unscrambling, a byte k is produced from S by choosing one of the 255 entries in a methodical manner, at that point the sections in S are permuted once more.

Key-Scheduling Algorithm:

Iinitialization: The sections of S are set equivalent to the qualities from 0 to 255 in climbing request, a transitory vector T, is made.

On the off chance that the length of the key k is 256 bytes, at that point k is allocated to T. Something else, for a key with length(k-len) bytes, the main k-len components of T as replicated from K and afterward K is rehashed the same number of times as important to fill T. The thought is represented as follow:

for
   i = 0 to 255 do S[i] = i;
T[i] = K[i mod k - len];

we use T to produce the initial permutation of S. Starting with S[0] to S[255], and for each S[i] algorithm swap it with another byte in S according to a scheme dictated by T[i], but S will still contain values from 0 to 255 :j = 0;
for
   i = 0 to 255 do
   {
       j = (j + S[i] + T[i])mod 256;
       Swap(S[i], S[j]);
   }
Pseudo random generation algorithm (Stream Generation):
When the vector S is introduced, the info key won't be utilized. In this progression, for each S[i] calculation trade it with another byte in S as indicated by a plan directed by the current arrangement of S. In the wake of coming to S[255] the procedure keeps, beginning from S[0] once more

i, j = 0;
while (true)
   i = (i + 1)mod 256;
j = (j + S[i])mod 256;
Swap(S[i], S[j]);
t = (S[i] + S[j])mod 256;
k = S[t];
BIT STREAM Encrypt using X-Or():XOR Encryption is an encryption technique used to scramble information and is difficult to break by animal power strategy, i.e creating arbitrary encryption keys to coordinate with the right one.


void encryptDecrypt(char inpString[])
{
   // Define XOR key
   // Any character value will work
   char xorKey = 'P';

   // calculate length of input string
   int len = strlen(inpString);

   // perform XOR operation of key
   // with every caracter in string
   for (int i = 0; i < len; i++)
   {
       inpString[i] = inpString[i] ^ xorKey;
       printf("%c",inpString[i]);
   }
}

// Driver program to test above function
int main()
{
   char sampleString[] = "GeeksforGeeks";

   // Encrypt the string
   printf("Encrypted String: ");
   encryptDecrypt(sampleString);
   printf("\n");

   // Decrypt the string
   printf("Decrypted String: ");
   encryptDecrypt(sampleString);

   return 0;
}

 

Related Solutions

In practice, an LFSR sequence would not be used as keystream for a stream cipher, due...
In practice, an LFSR sequence would not be used as keystream for a stream cipher, due to the linear complexity. Answer the following questions about linear complexity. What is the linear complexity of a maximal length LFSR output sequence? Describe one method using LFSRs to produce a binary output sequence but with increased linear complexity. Draw a diagram to illustrate your construction.
If a Vigenere cipher uses the keyword CATS, what is the key used and what is...
If a Vigenere cipher uses the keyword CATS, what is the key used and what is the ciphertext that corresponds to the plaintext CATSCANS
Write an algorithm that uses a stack, reads from a stream of objects (operations and values)...
Write an algorithm that uses a stack, reads from a stream of objects (operations and values) in prefix order, and prints the result of that evaluation. Trace 2 examples to demonstrate that your algorithm is valid. Analyze your algorithm with respect to n (the number of objects in the stream)
1 Introduction A cipher is an algorithm which encrypts a message into cipher text so that...
1 Introduction A cipher is an algorithm which encrypts a message into cipher text so that it can be safely transmitted without an eavesdropper being able to (easily) read it. For the purposes of this assignment the message and ciphertext will be stored as strings of ASCII characters. Cipher algorithms always perform two tasks: encryption and decryption. The encryption process takes a “message” and “key” as inputs and produces cipher text. The decryption process performs the reverse: it turns cipher...
Stream Cipher. A message is encoded by exclusive-or’ing each bit with a random bit stream. (In...
Stream Cipher. A message is encoded by exclusive-or’ing each bit with a random bit stream. (In exclusive or, 0⊕0 = 0, 1⊕0 = 1, 0⊕1 = 1, and 1⊕1 = 0.) a. Recover the original message from the random stream and encrypted stream, by filling in the blanks in the “Recovered” and “ASCII” rows. (In the ASCII column, interpret the byte as an ASCII character and write the value in that row.) Message: ? ? ? ? ? ? ?...
The Vigenère Cipher is an encryption algorithm that combines the use of a keyword with the...
The Vigenère Cipher is an encryption algorithm that combines the use of a keyword with the message to be encrypted. A tableau is provided that shows an encrypted character for each combination of characters in the message and the keyword. Using the Vigenère Tableau encryption scheme with a keyword of KEYWORD, encrypt the following message: IS INFORMATION SECURITY ESSENTIAL After encrypting the message, decrypt the following message, using KEYWORD as the keyword: YRJUW WWRIG JTFUW ERECE LCMKL CIWKR R For...
The mathematical expression of the encryption and decryption process of a Caesar cipher algorithm is expressed...
The mathematical expression of the encryption and decryption process of a Caesar cipher algorithm is expressed respectively as: c=Ep, k=p+k%26                                                                                                                         (1) p=Dc,k=c-k%26                                                                                                                         (2) Please do the following: Write at least two paragraphs to explain the principle of operation of the algorithm. For a full credit, your explanation must show the architectural diagram of the encryption and decryption process. Write a program to implement the Caesar algorithm Code must have two functions; encryption and decryption Test your codes with p as...
Encipher the following emperors’ names using a Shift Cipher with the given key. Pompeii, key =...
Encipher the following emperors’ names using a Shift Cipher with the given key. Pompeii, key = D. ___________ Vespasian, key = P. _________ Caligula, key = H. _________ Nero, key = T. _____________
Use Vigenère Cipher to decrypt the following plaintext with the given key key: deceptivedeceptivedeceptive plaintext: wearediscoveredsaveyourself
Use Vigenère Cipher to decrypt the following plaintext with the given key key: deceptivedeceptivedeceptive plaintext: wearediscoveredsaveyourself
Problem 1. Write two computer programs to simulate a Unicode stream cipher that consists of both...
Problem 1. Write two computer programs to simulate a Unicode stream cipher that consists of both encryption and decryption algorithms. The encryption program accepts inputs from an existing text file, called “letter.txt.” The encryption program produces an output ciphertext file, called “secret” The decryption program takes “secret” as input and decrypts it into a plaintext, called “message.txt.” - The random “seed” must be known, but be kept secure, by the pseudorandom number generators in both encryption and decryption programs. Note...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT