Created
July 12, 2020 23:11
-
-
Save doyle/eaf78f9a3cab38d18b9c22446d108a70 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
# decrypts messages in the Futurama AL2 language: https://theinfosphere.org/Alien_languages | |
encrypted_message = %w(19 0 4 21 25 17 4 18 10 4 6 13 6 13 21 8 14 14 6 25 21 9).map(&:to_i) | |
decrypted_message = '' | |
encrypted_message.each_with_index do |value, index| | |
if index > 0 | |
value = value - encrypted_message[index - 1] | |
value = value >= 0 ? value : 26 + value | |
end | |
decrypted_message << (97 + value).chr | |
end | |
puts "Decrypted: #{decrypted_message}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment