Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using this code provided: public class Assignment1Demo { private static String msg; private static String msgE; private static String msgD; private static int key; public

image text in transcribed

Using this code provided:

public class Assignment1Demo {

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, String msgE) {

//TODO: implement step d (decryption)

}

private static void bruteForce(String msgE) {

//TODO: implement bruteForce algorithm, you may need the above decryption(key,msgE) method

}

}

Programming Assignment 1 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. The encryption of a message M of length n (in bytes) is given by c. where the key K is repeated n/2 times. "II" here is String Concatenation Operator. The decryption algorithm for a ciphertext C is the same as the encryption algorithm: d. DAC) = C (K 11 K 11 K ). Implement a brute-force decryption attack for this cryptosystem and test it on randomly generated English character message. Automate the process of detecting whether a decrypted message is English characters. Graduate students task and bonus task for undergraduate students: The randomly generated message has to be an English words message rather than English character message. That means you have to use English words dictionary in your program. Thus, the brute force will continue until find an English words message

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learning PostgreSQL

Authors: Salahaldin Juba, Achim Vannahme, Andrey Volkov

1st Edition

178398919X, 9781783989195

More Books

Students also viewed these Databases questions