Question: Only in Java Use this skeleton public class 1Demo { private static String msg; private static String msgE; private static String msgD; private static int

Only in Java

Only in Java Use this skeleton public class 1Demo { private static

Use this skeleton

public class 1Demo {

private static String msg; private static String msgE; private static String msgD; private static int key;

public static void main(String[] args){ //TODO: You can only call methods in main method key = generateKey(); msg = generateMsg(); msgE = encryption(key,msg); bruteForce(msgE); }

private static int generateKey() { //TODO: implement step a (randomly generate 16-bit key) return 0; }

private static String generateMsg() { //TODO: implement step b (randonly generate a string with an even number of characters) return ""; }

private static String encryption(int key, String msg) { //TODO: implement step c (encrypt the message) return ""; }

private static void decryption(int key) { //TODO: implement step d (decryption) }

private static void bruteForce(String msgE) { //TODO: implement bruteForce algorithm, you may need the above decryption(msgE) method }

}

Implement a toy symmetric cryptosystem based on the following method. a. Keys are 16-bit randomly generated values. b. Messages are randomly generated strings with an even number of characters. (Valid characters are upper and lower case letters, as well as spaces.) One can always add a blank at the end of an odd-length string C. The encryption of a message M of length n (in bytes) is given by Ex (M)-M (KlKlK..), where the key K is repeated n/2 times. d. The decryption algorithm for a ciphertext C is the same as the encryption algorithm: DAC)-C9(KIKIK ). Implement a brute-force decryption attack for this cryptosystem and test it on randomly generated English text messages. Automate the process of detecting whether a decrypted message is English text

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!