Asked by Dennis
The following file cshift.txt is encrypted using a shift cipher. Decrypt it using key exhaustion. I expect to see 26 complete lines of output. Your program does not have to pick out which shift is English. You may do that by eyeball. Then print the proper plaintext (with spaces and punctuation) and then the encryption key. A program is a must.
BPQAT QNMQA IBMAB QBQAW VTGIB MABQN QBPIL
JMMVI VIKBC ITTQN MGWCE WCTLP IDMZM KMQDM
LQVAB ZCKBQ WVAWV EPMZM BWOWI VLEPI BBWLW
BPQAT QNMQA IBMAB QBQAW VTGIB MABQN QBPIL
JMMVI VIKBC ITTQN MGWCE WCTLP IDMZM KMQDM
LQVAB ZCKBQ WVAWV EPMZM BWOWI VLEPI BBWLW
Answers
Answered by
Steve
Shift: 18
THISL IFEIS ATEST ITISO NLYAT ESTIF ITHAD BEENA NACTU ALLIF EYOUW OULDH AVERE CEIVE DINST RUCTI ONSON WHERE TOGOA NDWHA TTODO
I assume you can split into proper English words.
perl program that found key:
my $cipher = "BPQAT QNMQA IBMAB QBQAW VTGIB MABQN QBPIL JMMVI VIKBC ITTQN MGWCE WCTLP IDMZM KMQDM LQVAB ZCKBQ WVAWV EPMZM BWOWI VLEPI BBWLW";
my @cipher = split(//,$cipher);
foreach my $i (0..26) {
my @plain = ();
foreach my $c (@cipher) {
if ($c =~ /\s/) {push @plain,$c;next;}
push @plain,chr(65+(ord($c)-65+$i)%26);
}
printf "\nShift: $i\n%s\n",join("",@plain);
}
THISL IFEIS ATEST ITISO NLYAT ESTIF ITHAD BEENA NACTU ALLIF EYOUW OULDH AVERE CEIVE DINST RUCTI ONSON WHERE TOGOA NDWHA TTODO
I assume you can split into proper English words.
perl program that found key:
my $cipher = "BPQAT QNMQA IBMAB QBQAW VTGIB MABQN QBPIL JMMVI VIKBC ITTQN MGWCE WCTLP IDMZM KMQDM LQVAB ZCKBQ WVAWV EPMZM BWOWI VLEPI BBWLW";
my @cipher = split(//,$cipher);
foreach my $i (0..26) {
my @plain = ();
foreach my $c (@cipher) {
if ($c =~ /\s/) {push @plain,$c;next;}
push @plain,chr(65+(ord($c)-65+$i)%26);
}
printf "\nShift: $i\n%s\n",join("",@plain);
}
There are no AI answers yet. The ability to request AI answers is coming soon!
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.