Created
July 8, 2018 09:34
-
-
Save Techbrunch/999e229934711ff26cdf7d9629212764 to your computer and use it in GitHub Desktop.
Intercal Decoder
This file contains hidden or 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
arr = [238,140,120,0,112,154,194,172,72,32,24,240,160,232,26,52] | |
def decode(pos = 0, array) | |
array.map { |x| | |
pos = (256 + pos - x) % 256 | |
pos.to_s(2) | |
.rjust(8, '0') | |
.reverse | |
.to_i(2) | |
.chr | |
}.join | |
end | |
puts decode(arr) | |
# Happy Birthday! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment