Lest take letters used as one time pass (using circular arithmetic). If one gets cyper-text
GUTV
One can't know anything about plain-text except that it is 4 letters long.
It can be
BOMB or LOVE or any other word. You cant distinguishing and neither is more probable than another.
But if you have two plain-texts using same pad, that mean than once you take one solution, second one is automatically defined.
Using some trial and error (or computer with vocabulary) you can significantly reduce to just few options at worst.
So you get from something that is total secure, (true one time pad) to something that is easily breakable.
EDIT
Here is little cracker writen in python
You need file of words. I take if from http://norvig.com/big.txt
What this code does it takes two words bomb
and love
and uses pad/password haha
to encrypt both. It then finds out all possible passwords that decrypts this cypertexts pairs to words from vocabulary.
import re
with open("big.txt","r") as f:
words = set(re.findall('[a-z]+', f.read().lower()))
def encrypt(word,password):
add_letters = lambda x,y:chr((ord(x)+ord(y)-2*ord('a'))%26 + ord('a'))
return "".join(add_letters(*i) for i in zip(word.lower(),password.lower()))
def decrypt(word,password):
sub_let = lambda x,y:chr((ord(x)-ord(y)+26)%26 + ord('a'))
return "".join(sub_let(*i) for i in zip(word.lower(),password.lower()))
def crack(a,b):
assert(len(a) == len(b))
w = (i for i in words if len(i) == len(a))
for i in w:
password = decrypt(a,i)
b_plain= decrypt(b,password)
if b_plain in words:
print(i,b_plain,password)
password = "haha"
a="bomb"
b="love"
a_cyper=encrypt(a,password)
b_cyper=encrypt(b,password)
print("cyper",a_cyper,b_cyper)
crack(a_cyper,b_cyper)
Output:
('cyper', 'iotb', 'soce')
('tomb', 'dove', 'paha')
('bath', 'lack', 'hoau')
('bomb', 'love', 'haha') <---
('vote', 'foch', 'naax')
('reid', 'berg', 'rkly')
('tank', 'dawn', 'pogr')
('felo', 'peur', 'dkin')
('hath', 'rack', 'boau')
('cork', 'moan', 'gacr')
('rath', 'back', 'roau')
('ruth', 'buck', 'ruau')
('bank', 'lawn', 'hogr')
('rake', 'bath', 'rojx')
('mike', 'with', 'wgjx')
('hero', 'rear', 'bkcn')
('comb', 'move', 'gaha')
('foch', 'polk', 'daru')
('foci', 'poll', 'dart')
('both', 'lock', 'haau')
('peri', 'zeal', 'tkct')
('maim', 'warp', 'wolp')
('limb', 'vive', 'xgha')