Write a script to apply the right form of cryptoanalysis able to disclose the pl
ID: 3748557 • Letter: W
Question
Write a script to apply the right form of cryptoanalysis able to disclose the plaintext of the text below. Hint: it's the lyrics of a song.
FCGUNKBHEJGCLKFCGUNKBHEJGCLKFCGUNKBHEJGCLKFCGUNKBHEJGCLKF
CGUNKBHEJGCLKFCGUNKBHEJGCLKFCGUNKBHEJGCLKFCGUNKBHEJGCLKFC
GUNKBHEJGCLKFCGUNKBHEJGCLKFCGUNKBHEJGCLKFCGUNKBHEJGCLKFCG
UNKBHEJGCLKFCGUNKBHEJGCLKFCGUNKBHEJGCLKFCGUNKBHEJGCLKFCGU
NKBHEJGCLKFCGUNKBHEJGCLKFCGUNKBHEJGCLKFCGUNKBHEJGCLKFCGUN
KBHEJGCLKFCGUNKBHEJGCLKFCGUNKBHEJGCLKFCGUNKBHEJGCLKFCGUNK
BHEJGCLKFCGUNKBHEJGCLKFCGUNKBHEJGCLKFCGUNKBHEJGCLKFCGUNKB
HEJGCLKFCGUNKBHEJGCLKFCGUNKBHEJGCLKFCGUNKBHEJGCLKFCGUNKBH
EJGCLKFCGUNKBHEJGCLKFCGUNKBHEJGCLKFCGUNKBHEJGCLKFCGUNKBHE
JGCLKFCGUNKBHEJGCLK
Note: need the solution in Java language
Explanation / Answer
its polyalphabetic cipher encryption technique given below is the method how its done but you havenot provided the key to decipher it ( GIVE A THUMPS UP FOR THIS DONT DISLIKE FOR NOT PROVIDING KEY FOR DECRPTION)
import java.util.*;
public class PolyalphabeticCipherEncryption {
public static void main(String []args) {
String plaintext = "meet me after the toga party";
String key = "sololearn";
String final_key = "", ciphertext = "";
ArrayList<ArrayList<Character>> vignere = new ArrayList<>();
String alphabet = "abcdefghijklmnopqrstuvwxyz";
for (int i = 0; i < 26; i++) {
ArrayList<Character> row_vignere = new ArrayList<>();
for (int j = 0; j < 26; j++)
row_vignere.add(alphabet.charAt((i + j) % 26));
vignere.add(row_vignere);
}
for (int i = 0, j = 0; i < plaintext.length(); i++) {
if (plaintext.charAt(i) >= 'a' && plaintext.charAt(i) <= 'z')
final_key += key.charAt((j++) % key.length());
else
final_key += plaintext.charAt(i);
}
for (int i = 0; i < plaintext.length(); i++) {
if (plaintext.charAt(i) >= 'a' && plaintext.charAt(i) <= 'z')
ciphertext += vignere.get(alphabet.indexOf("" + final_key.charAt(i))).get(alphabet.indexOf("" + plaintext.charAt(i)));
else
ciphertext += plaintext.charAt(i);
}
System.out.println("Polyalphabetic Cipher [Encryption]");
System.out.println("Plain Text : " + plaintext);
System.out.println("Key : " + key);
System.out.println("Cipher Text : " + ciphertext);
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.