Making a cipher solver in godot


Honestly this wasn't the hardest task as godot is very easy to use
and I have been using it for a while. The project was mostly for me
and my friends to use for a challenge. It's not got all features i
was going to add but I thought it was good enough for what we were
doing. It covers 5 common ciphers Caesar, Affine, Vigenere, Polybius, Morse


The Caesar family of ciphers


Most of these ciphers a just a caesar in a trench coat with affine you
you just take the orginal letters spot in the alphabet and times it by
some number before shifting it so instead of x + b it's ax + b. And
for vigenere you use a code word which repeats over the plaintext to
and you shift each letter of plaintext by its paired letter in the key
position in the alphabet where a=0 and z=25. These were all simple to
implement a way to decode for caesar and vigenere I just shift the
alphabet back by whatever the key is and run the letters through it

ciphertxt = "Ifmmp Xpsme"
alphabet = list("abcdefghijklmnopqrstuvwxyz")
shift = -1
output = ""
for chr in list(ciphertxt.lower()):
 if chr not in alpha:
  output += chr
  continue
 new_char = alpha.index(chr) + shift % 26
 if new_char < 0:
  new_char = 26 + new_char
 output += alpha[new_char]

A simple implementation of what I did is shown above in python.
This works for both caesar and vigenere just swap out the shift
value. And a similar thing can be done for affine. I also added
a general substitution cipher option for if none off the following
work


Morse Code


Not really a cipher but I expected to see it anyways so I made a quick
solver just a hashmap mapping all morse letters into there alphabetical
equivelent and splitting the input by spaces. Super easy to make like I
said it's not really a cipher it's not meant to be hard to use or decrypt


Tap code/Polybius Square


This is also not to hard I set every combo of two numbers 1-5 equal to a
letter with one letter pairing up often i and j or c and k. and I take
an input of these combos seperated by a space and just convert one into
the other.


Let's get Rusty


I don't want to bother writing another post about my rust cli version of
this. It's only got caesar, affine and vigenere but it works a lot faster
than my godot version. It's bad rust code most likely as I am new to the
language but it has me hooked. I've been loving writing Rust even as the
bottow checking gets mad at me and I struggle to understand somethings


Godot Cipher Solver Source Code
Rust Cipher Solver Source Code

Sometimes i wonder why my name is always penguin. Guess I'll keep wondering.
Lsj eic sdyaj uv rpwgkl mtv kb zi pgitf://zibnapl-xyiy-lioycbr.siau.xmi/hipxybf/lsj-xyiyac-puit