Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

One popular cryptographic method for encoding a message issubstituting a letter

ID: 3616118 • Letter: O

Question

One popular cryptographic method for encoding a message issubstituting a letter for each letter of the alphabet. For example,the substitution

Plaintextletter - abcdefghijklmnopqrstuvwxyz

Ciphertextletter - HETJWOPSQYAZIVMBDUKNRGLCXF

Turns the plaintext “omnia Gallia est divisa in partiestrees” into the ciphertext “MIVQH PHZZQH WKN QV BHUNWKNUWK”. Note that the substitution is a permutation of the 26letters of the alphabet, so we can uniquely decipher a ciphertextby reading the substitution backwards; that is ciphertext“A” is plaintext “k”, “B” is“p” and so on.

Write a program that takes as an input a plaintext, generates arandom substitution, and then encrypts the plaintext using thatsubstitution. All substitutions should occur with the sameprobability. (in java)

Plaintextletter - abcdefghijklmnopqrstuvwxyz

Ciphertextletter - HETJWOPSQYAZIVMBDUKNRGLCXF

Explanation / Answer

please rate - thanks asciitable.com may help understanding some of the math import java.util.*; public class untitled { public static void main(String[] args) {Random random = new Random(); int length=26; boolean []used=new boolean[length]; String key="",input; int i,usedcount=0; Scanner in=new Scanner(System.in); for(i=0;i