Using AI to Create Code breaking programs for Zodiac Killer

Sam Fisher
2 min readOct 20, 2024

Python Code: AI Generated decoder

I just wanted to throw out a program for breaking a coded message first using a Caesar shift, then using a keyword to break a coded message that was Caesar shifted then encoded using a vigenere cipher method.

Copy and paste the following into a python interpreter such as https://www.programiz.com/python-programming/online-compiler/:

def caesar_shift(text, shift):
result = ‘’
for char in text:
if char.isalpha():
base = ord(‘A’) if char.isupper() else ord(‘a’)
# Shift character and wrap around the alphabet
shifted = chr((ord(char) — base + shift) % 26 + base)
result += shifted
else:
# Non-alphabetic characters remain unchanged
result += char
return result

def vigenere_decrypt(ciphertext, keyword):
plaintext = ‘’
keyword_indices = [ord(k.lower()) — ord(‘a’) for k in keyword]
keyword_length = len(keyword_indices)
keyword_position = 0

for char in ciphertext:
if char.isalpha():
base = ord(‘A’) if char.isupper() else ord(‘a’)
# Get the shift amount from the keyword
key_shift = keyword_indices[keyword_position % keyword_length]
# Decrypt the character using the Vigenère cipher
decrypted_char = chr((ord(char.lower()) — base — key_shift + 26) % 26 + base)
# Preserve the original case
plaintext += decrypted_char.upper() if char.isupper() else decrypted_char
keyword_position += 1
else:
plaintext += char
return plaintext

def main():
encrypted_text = input(“Enter the encrypted text: “)
keyword = input(“Enter the Vigenère cipher keyword: “)

print(“\nAll possible decryptions:”)
for shift in range(26):
# Apply Caesar shift
shifted_text = caesar_shift(encrypted_text, shift)
# Decrypt with Vigenère cipher
decrypted_text = vigenere_decrypt(shifted_text, keyword)
print(f”Shift {shift:2}: {decrypted_text}”)

if __name__ == “__main__”:
main()

Ok, so as an experiment I used the following I encoded “HELLOWORLD” seven shifts using a ceasar cipher, then used the word HELLOWORLD to encode that, but the program decrypted it saying shift 13 was the correct one. Not sure but still the correct solution is in there:

See below:

Enter the encrypted text: VPDDJZJPDN
Enter the Vigenère cipher keyword: HELLOWORLD

All possible decryptions:
Shift 0: URYYBJBEYQ
Shift 1: VSZZCKCFZR
Shift 2: WTAADLDGAS
Shift 3: XUBBEMEHBT
Shift 4: YVCCFNFICU
Shift 5: ZWDDGOGJDV
Shift 6: AXEEHPHKEW
Shift 7: BYFFIQILFX
Shift 8: CZGGJRJMGY
Shift 9: DAHHKSKNHZ
Shift 10: EBIILTLOIA
Shift 11: FCJJMUMPJB
Shift 12: GDKKNVNQKC
Shift 13: HELLOWORLD
Shift 14: IFMMPXPSME
Shift 15: JGNNQYQTNF
Shift 16: KHOORZRUOG
Shift 17: LIPPSASVPH
Shift 18: MJQQTBTWQI
Shift 19: NKRRUCUXRJ
Shift 20: OLSSVDVYSK
Shift 21: PMTTWEWZTL
Shift 22: QNUUXFXAUM
Shift 23: ROVVYGYBVN
Shift 24: SPWWZHZCWO
Shift 25: TQXXAIADXP

=== Code Execution Successful ===

I have tried various means to decrypt the Z18, or the final 18 letters of the zodiac killer coded message to see what I can come up with.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response