KATHRYN and her school friends have been using a Lorenz-type code to pass covert messages to each other. Each letter is expressed as a five-digit binary number such that A = 1 = 00001, M = 13 = 01101 and so on, but other symbols are represented by 00000 and by 11011 upwards.
A fixed letter, say M, is chosen as a “coder”, known only to the sender and receiver. To transmit a letter, say D, it is added to the coder by the “exclusive-NOR” rule 1 + 1 = 1, 1 + 0 = 0, 0 + 1 = 0, 0 + 0 = 1. So, for example, D + M = 00100 + 01101 = 10110 = V. When the sent letter V is added by the recipient to the coder M, the original letter reappears: 10110 + 01101 = 00100.
She has sent her name to her friends as seven letters. KATHRYN and its coded version together consist of 14 different letters.
What was the coded version?
Note: Adapted from Enigma Number:1764 by Adrian Sommerfield, which appered in the New Scientist on 28 August, 2013.
clearvars,clc
alpha=' abcdefghijklmnopqrstuvwxyz.,-()';
alphabet=alpha(2:27);
plain='kathryn';
for coder=2:27
good=true;
cypher='';
for i=1:length(plain)
v=strfind(alpha,plain(i))-1;
vp=bitxor(v,coder);
vp=31-vp;
cypher(i)=alpha(vp+1);
if length(setdiff(cypher,alphabet))>0
good=false;
break
end
end
if good
if length(unique([plain,cypher]))==14
disp([alpha(coder+1) ' ' plain ' ' cypher])
end
end
end
finds the coder is d and kathryn codes as pzosibu.
Other coders, such as i result in special symbols in the cyphertext:
b kathryn v,iuods
i kathryn -wb(dox
k kathryn )u ,fmz
o kathryn .qdxbi(
q kathryn eozf,w
s kathryn gmxd(ub
w kathryn ci, zqf
and if the coder is g, there are not 14 different letter in the concatenation of the plaintext and cyphertext:
g kathryn sylpjav
The remaining coders result in both symbols and in duplicate characters.
|
Posted by Charlie
on 2024-09-06 10:17:05 |