Question: (stream chiper )can you do this in java please ALL YOU NEED TO DO THIS WRITE WITHIN THE CODE. there are 4 parts within the

(stream chiper
)can you do this in java please
ALL YOU NEED TO DO THIS WRITE WITHIN THE CODE. there are 4 parts within the code that need to be written ( in the comments)
please help will eave excellent rating
import java.util.ArrayList;
public class Rc4 {
/**
* Encrypt plaintext with key. Place output in ciphertext.
*/
public void encrypt(ArrayList plaintext, ArrayList key,
ArrayList ciphertext) {
assert key.size() >= 5 : "Key too short";
assert key.size()
// WRITE ME (1/4)
}
/**
* Decrypt cyphertext with key. Place output in plaintext.
*/
public void decrypt(ArrayList ciphertext, ArrayList key,
ArrayList plaintext) {
// WRITE ME (2/4)
// Hint: THINK THIS ONE THROUGH. Copy & Paste is a waste of time.
}
/**
* Generate the key schedule s corresponding to the key.
*/
private void genKSA(ArrayList key, ArrayList s) {
// WRITE ME (3/4)
}
/**
* Generate a key stream keyStream of numBytes bytes, using key.
*/
private void genKeyStream(ArrayList key, ArrayList keyStream,
int numBytes) {
// WRITE ME (4/4)
}
/**
* Encrypt the phrase "Attack at dawn" using key "Secret". Use the
* ciphertext and the key to recover the plaintext in order to verify your
* answer.
*/
public static void main(String[] args) {
Rc4 rc4 = new Rc4();
ArrayList key = new ArrayList();
String k = "Secret";
for (int i=0; i
key.add((int)k.charAt(i));
}
ArrayList pt = new ArrayList();
String p = "Attack at dawn";
for (int i=0; i
pt.add((int)p.charAt(i));
}
ArrayList ct = new ArrayList(pt.size());
rc4.encrypt(pt, key, ct);
System.out.print("Ciphertext: ");
for (int c=0; c
System.out.print(Integer.toHexString(ct.get(c))+" ");
System.out.println();
pt.clear();
rc4.decrypt(ct, key, pt);
System.out.print("Recovered plaintext: ");
for (int c=0; c
System.out.print((char) pt.get(c).intValue());
System.out.println();
}
}
 (stream chiper )can you do this in java please ALL YOU
RC4 was a commonly used stream cipher, until certain flaws were discovered in it. The algorithm is readily available in many places, including a fairly well-written Wikipedia page. In this assignment, you will create your own implementation of RC4 in a language of your choice. Your implementation must be based on that algorithm described on that page. Your implementation must be original. While you are more than welcome to search around on the Internet for clues as to how to create the class, every line of code must be written by you, and you must be able to explain all code submitted Assignment Implement RCA. Use the provided code template as a starting point. You may also redo this code in a language of your choice Note: If you choose not to implement in Java, just upload a blank jave file in addition to your code. You won't be able to run in Moodle, but I'll figure it out

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!