[Ruby] Halcyon V2 06-18-2015, 12:03 AM
#1
Back when I started programming Ruby, I made an encryption program named halcyon. It was really bulky and not all that efficient. Since I haven't made any release threads in a while, I decided to remake it as a command line tool.
Syntax/Usage:
an example would be:
the e and d simply stand for Encrypt and Decrypt. When executed, Halcyon overwrites the file with the encrypted or decrypted message.
Sample I/O:
Input:
Output:
The true beauty of Halcyon lies in it's simplicity. It follows no algorithms, but instead reads directly from the keys hash. Without the Halcyon2 file, it's practically impossible to decrypt messages(unless you do something idiotic like write a sign-off like the Nazis. Terrible waste of effort with Enigma).
Source Code:
GitHub Gist here.
Syntax/Usage:
Code:
ruby Halcyon2.rb <filename> <e|d>an example would be:
Code:
ruby Halcyon2.rb test.txt ethe e and d simply stand for Encrypt and Decrypt. When executed, Halcyon overwrites the file with the encrypted or decrypted message.
Sample I/O:
Input:
Code:
test123Output:
Code:
620APT08H2QV620AUHWXS9M0QVBZThe true beauty of Halcyon lies in it's simplicity. It follows no algorithms, but instead reads directly from the keys hash. Without the Halcyon2 file, it's practically impossible to decrypt messages(unless you do something idiotic like write a sign-off like the Nazis. Terrible waste of effort with Enigma).
Source Code:
Spoiler: V2.0
Code:
processed = []
keys = { "a" => "86L2",
"b" => "O9FU",
"c" => "DGC9",
"d" => "72JE",
"e" => "PT08",
"f" => "L1WN",
"g" => "ZBRX",
"h" => "33C6",
"i" => "FB2M",
"j" => "0LJW",
"k" => "F6I2",
"l" => "AJJ5",
"m" => "EVET",
"n" => "0SHX",
"o" => "8PUV",
"p" => "TSVW",
"q" => "XHLV",
"r" => "K45G",
"s" => "H2QV",
"t" => "620A",
"u" => "LY1E",
"v" => "XEJ4",
"w" => "W8UN",
"x" => "RKJA",
"y" => "R06K",
"z" => "32ZG",
"0" => "P1E1",
"1" => "UHWX",
"2" => "S9M0",
"3" => "QVBZ",
"4" => "S13P",
"5" => "I3KN",
"6" => "IK9O",
"7" => "8WGY",
"8" => "ACXY",
"9" => "NGNY",
" " => "FUH3" }
if ARGV[1] == "e"
file = File.read(ARGV[0]).each_char { |c| c = keys[c]
processed << c }
output = File.open(ARGV[0], "w")
output << processed.join("")
elsif ARGV[1] == "d"
file = File.read(ARGV[0]).scan(/.{4}/).each { |c| c = keys.key(c)
processed << c }
output = File.open(ARGV[0], "w")
output << processed.join("")
endSpoiler: V2.1
Code:
processed = []
keys = { "a" => "x1PMUle1YZ",
"b" => "cM8ezAO4mT",
"c" => "skdirR0oI9",
"d" => "IdxGznRoIZ",
"e" => "ZW0f35X4mS",
"f" => "zZCGnyLltR",
"g" => "6H8dxPoZZQ",
"h" => "lBtkPHsWMX",
"i" => "pMfx9g454h",
"j" => "ArXZoTVTqJ",
"k" => "UDgNZ2qW6I",
"l" => "NG3x9cz3gq",
"m" => "frEGyWgMDQ",
"n" => "NETk9nxJwh",
"o" => "1UqQM6GzQT",
"p" => "LL0Sz98mLz",
"q" => "yeQ30rQXq5",
"r" => "ZbpBptRJ0s",
"s" => "hMvCoFWLwb",
"t" => "26Xgy6cWx3",
"u" => "P26SpuVXZB",
"v" => "UHZPZ79j7P",
"w" => "EqMuFaylXs",
"x" => "lxHtXkhaS9",
"y" => "NuHrkdtlvv",
"z" => "xK3QaLxhRC",
"0" => "2IkGJVc3sj",
"1" => "p6Ncbj5W5I",
"2" => "C21jtUbZm6",
"3" => "eGCtWDWp1d",
"4" => "mwrt8xGm9L",
"5" => "TjI891ggrI",
"6" => "7WVrc06BP8",
"7" => "Qiphkiq110",
"8" => "RxULizlNli",
"9" => "AhYI8vPlRu",
"\." => "ZBa17n60A7",
"\," => "XZZEslsZIR",
"\'" => "p51BTqm9uq",
"\\" => "qEKnsFAKoy",
"\/" => "cSX1m4CK6K",
"\[" => "OJ8LBUiq1a",
"\]" => "iHUUKANMK1",
"\-" => "u5A9wbEUTe",
"\_" => "6VH868pKWU",
"\+" => "MYmroEEL1X",
"\=" => "L70NPBI5Ed",
"\?" => "g31VmAgjUp",
"\!" => "OMTU9kQeuG",
"\#" => "HqZefstFCE",
"\&" => "WvBZWl1lAd",
"\n" => "lV0031YeaP",
"\t" => "XaWpcKU6nF" }
if ARGV[1] == "e"
file = File.read(ARGV[0]).each_char { |c| c = keys[c]
processed << c }
output = File.open(ARGV[0], "w")
output << processed.join("").reverse
elsif ARGV[1] == "d"
file = File.read(ARGV[0]).scan(/.{10}/).each { |c| c = keys.key(c)
processed << c }
output = File.open(ARGV[0], "w")
output << processed.join("").reverse
endSpoiler: V2.2
Code:
processed = []
keys = { "a" => "x1PMUle1YZ",
"b" => "cM8ezAO4mT",
"c" => "skdirR0oI9",
"d" => "IdxGznRoIZ",
"e" => "ZW0f35X4mS",
"f" => "zZCGnyLltR",
"g" => "6H8dxPoZZQ",
"h" => "lBtkPHsWMX",
"i" => "pMfx9g454h",
"j" => "ArXZoTVTqJ",
"k" => "UDgNZ2qW6I",
"l" => "NG3x9cz3gq",
"m" => "frEGyWgMDQ",
"n" => "NETk9nxJwh",
"o" => "1UqQM6GzQT",
"p" => "LL0Sz98mLz",
"q" => "yeQ30rQXq5",
"r" => "ZbpBptRJ0s",
"s" => "hMvCoFWLwb",
"t" => "26Xgy6cWx3",
"u" => "P26SpuVXZB",
"v" => "UHZPZ79j7P",
"w" => "EqMuFaylXs",
"x" => "lxHtXkhaS9",
"y" => "NuHrkdtlvv",
"z" => "xK3QaLxhRC",
"0" => "2IkGJVc3sj",
"1" => "p6Ncbj5W5I",
"2" => "C21jtUbZm6",
"3" => "eGCtWDWp1d",
"4" => "mwrt8xGm9L",
"5" => "TjI891ggrI",
"6" => "7WVrc06BP8",
"7" => "Qiphkiq110",
"8" => "RxULizlNli",
"9" => "AhYI8vPlRu",
" " => "C4fG3EsdSq",
"\." => "ZBa17n60A7",
"\," => "XZZEslsZIR",
"\'" => "p51BTqm9uq",
"\\" => "qEKnsFAKoy",
"\/" => "cSX1m4CK6K",
"\[" => "OJ8LBUiq1a",
"\]" => "iHUUKANMK1",
"\-" => "u5A9wbEUTe",
"\_" => "6VH868pKWU",
"\+" => "MYmroEEL1X",
"\=" => "L70NPBI5Ed",
"\?" => "g31VmAgjUp",
"\!" => "OMTU9kQeuG",
"\#" => "HqZefstFCE",
"\&" => "WvBZWl1lAd",
"\n" => "lV0031YeaP",
"\t" => "XaWpcKU6nF" }
keys.default = ""
fakes = ["DcJEwb4Ftx", "eI1hFDxGHk", "POR1fbLBd4"]
rand = *(0..9)
if ARGV[1] == "e"
file = File.read(ARGV[0]).each_char { |c| c = keys[c]
processed << c
processed << fakes.sample if rand.sample % 3 == 0 }
output = File.open(ARGV[0], "w")
output << processed.reverse.join("")
elsif ARGV[1] == "d"
file = File.read(ARGV[0]).scan(/.{10}/).each { |c| c = keys.key(c)
processed << c }
output = File.open(ARGV[0], "w")
output << processed.reverse.join("")
endGitHub Gist here.
It's often the outcasts, the iconoclasts ... those who have the least to lose because they
don't have much in the first place, who feel the new currents and ride them the farthest.
don't have much in the first place, who feel the new currents and ride them the farthest.

















![[+]](https://sinister.li/images/modern/collapse_collapsed.png)








