Skip to content

Instantly share code, notes, and snippets.

@yoggy
Created March 7, 2011 07:07
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save yoggy/858174 to your computer and use it in GitHub Desktop.
Save yoggy/858174 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby # # CODEGATE2011 CTF Pre-qual Crypto100 Writeup # # how to: # $ ruby crypt100-writeup.rb # incryptographyasubstitutioncipherisamethodofencryptionbywhichunitsof # plaintextarereplacedwithciphertextaccordingtoaregularsystemtheun
#!/usr/bin/ruby
#
# CODEGATE2011 CTF Pre-qual Crypto100 Writeup
#
# how to:
# $ ruby crypt100-writeup.rb
# incryptographyasubstitutioncipherisamethodofencryptionbywhichunitsof
# plaintextarereplacedwithciphertextaccordingtoaregularsystemtheunits
# maybesingleletterspairsofletterstripletsoflettersmixturesoftheabovethis
# ciphertextisencryptedbytelephonekeypadsowecallthiskeypadcipher
#
# -> keypad cipher
#
ary = [
444, 66, 222, 777, 999, 7, 8, 666, 4, 777,
2, 7, 44, 999, 2,7777, 88, 22,7777, 8,
444, 8, 88, 8, 444, 666, 66, 222, 444, 7,
44, 33, 777, 444,7777, 2, 6, 33, 8, 44,
666, 3, 666, 333, 33, 66, 222, 777, 999, 7,
8, 444, 666, 66, 22, 999, 9, 44, 444, 222,
44, 88, 66, 444, 8,7777, 666, 333, 7, 555,
2, 444, 66, 8, 33, 99, 8, 2, 777, 33,
777, 33, 7, 555, 2, 222, 33, 3, 9, 444,
8, 44, 222, 444, 7, 44, 33, 777, 8, 33,
99, 8, 2, 222, 222, 666, 777, 3, 444, 66,
4, 8, 666, 2, 777, 33, 4, 88, 555, 2,
777,7777, 999,7777, 8, 33, 6, 8, 44, 33,
88, 66, 444, 8,7777, 6, 2, 999, 22, 33,
7777, 444, 66, 4, 555, 33, 555, 33, 8, 8,
33, 777,7777, 7, 2, 444, 777,7777, 666, 333,
555, 33, 8, 8, 33, 777,7777, 8, 777, 444,
7, 555, 33, 8,7777, 666, 333, 555, 33, 8,
8, 33, 777,7777, 6, 444, 99, 8, 88, 777,
33,7777, 666, 333, 8, 44, 33, 2, 22, 666,
888, 33, 8, 44, 444,7777, 222, 444, 7, 44,
33, 777, 8, 33, 99, 8, 444,7777, 33, 66,
222, 777, 999, 7, 8, 33, 3, 22, 999, 8,
33, 555, 33, 7, 44, 666, 66, 33, 55, 33,
999, 7, 2, 3,7777, 666, 9, 33, 222, 2,
555, 555, 8, 44, 444,7777, 55, 33, 999, 7,
2, 3, 222, 444, 7, 44, 33, 777
]
table = {
2 => "a",
22 => "b",
222 => "c",
3 => "d",
33 => "e",
333 => "f",
4 => "g",
44 => "h",
444 => "i",
5 => "j",
55 => "k",
555 => "l",
6 => "m",
66 => "n",
666 => "o",
7 => "p",
77 => "q",
777 => "r",
7777 => "s",
8 => "t",
88 => "u",
888 => "v",
9 => "w",
99 => "x",
999 => "y",
9999 => "z"
}
ans = ary.map {|n| table[n]}
ans.each_with_index {|c, i|
print c
}
puts
@UCoderiss
Copy link

Thank you, I was looking for some sort of cipher list and this was very helpful .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment