-
-
Save AaronRandall/41bbf4032ad6166cdbaa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ciphertexts = [ | |
"VGYURYPEDFNCEPGEWELLPVNWRDCNFGMGXQEPPRG-CBFIGLEMG", | |
"EQ’PMEIGQNVBAGBTFEGMSYNRKMNWEPBLWBYPSNWMQNFBDWEQVYNR-CBFIGLEMG" | |
] | |
names = [ | |
"RYANNORTH", | |
"BUBBLEGUM", | |
"MARCELINE", | |
"RAINICORN" | |
] | |
signature = "CBFIGLEMG" | |
known_keys = signature.chars | |
all_keys = ("A".."Z").to_a | |
unknown_keys = (all_keys - known_keys) | |
names.each do |name| | |
puts "Name: #{name}" | |
ciphertexts.each do |ciphertext| | |
ciphertext_before = ciphertext | |
ciphertext_after = ciphertext.tr(signature, name) | |
ciphertext_known_keys = ciphertext.tr(unknown_keys.join, "_").tr(signature, name) | |
puts "Ciphertext before: #{ciphertext_before}" | |
puts "Ciphertext after: #{ciphertext_after}" | |
puts "Ciphertext known keys: #{ciphertext_known_keys}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment