Decode Text encrypted with DH coded with Caesar Cipher.
We have to decode following text: FKXSQBQZACKFAHRSCAN DFYZSYQBSFN. I have tried to "guess" the private Key for Alice with a for loop and think I got the right one but now I'm stuck. p,g and A are given.
p = 23
g = 15
A = 6 #exchangeKey Alice
I think the problem could be that I don't know how the text is coded. Did the teacher use an array like?:
alphabet = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
Or did she use the ASCII table.
But is it even possible to decode this text without any information about "Bob". My research brought only information about MITM attacks where the hacker got p,g,A and B
Get Alicekey
for getkeyalice in range(p):
if (g**getkeyalice)%p == A:
keyalice = getkeyalice
Decode
for char in message:
#index=(alphabet.index(char)-j)
#decryptedlst.append(alphabet[index])
decryptedlst.append(chr(ord(char)-i))
decrypted = ''.join(decryptedlst)
print("decrypted message:\t"+str(decrypted))
I'm looking for the decryption key. I don't expect this should be a very high number. But even bruteforcing all numbers from 1-4096 didn't help. So back to the top.... perhaps the kind of decryption I'm using is different to the encryption of the teacher.