Login Register






[Ruby] Halcyon V2 filter_list
Author
Message
[Ruby] Halcyon V2 #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:

Code:
ruby Halcyon2.rb <filename> <e|d>

an example would be:
Code:
ruby Halcyon2.rb test.txt e

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:
Code:
test123

Output:
Code:
620APT08H2QV620AUHWXS9M0QVBZ

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:
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("") end

Spoiler: 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 end

Spoiler: 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("") end


GitHub 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.

Reply

RE: [Ruby] Halcyon V2 #2
Please redefine the hashtable and encrypt a message and I will cryptanalyze your cipher. This is not safe and I will prove it.

For good proof of concept, please provide an English-language phrase with 5 or more words. Preferably not more than 30.
PGP
Sign: F202 79C9 76F7 40BB 54EC 494F 5DEF 1D70 14C1 C4CC
Encrypt: A5B3 1B21 55E1 80AF 4C6E DE83 467B 8EFC 3DEE 681C
Auth: CD55 E8A5 1A08 2933 8BA6 BC88 D81F 1943 739A 3C47

Reply

RE: [Ruby] Halcyon V2 #3
Since @Reiko cracked it, I'm updating the code to be a little more advanced
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.

Reply

RE: [Ruby] Halcyon V2 #4
Nice job, @Reiko. Seems neat. Good work kiddo.

IM GAY DAD

Reply

RE: [Ruby] Halcyon V2 #5
I guess I'll do a short writeup on cracking this in its current form.. it's a little bit more than a basic substitution cipher and I have to give credit for tripping up EVERY SINGLE ONLINE FREQUENCY ANALYSIS TOOL.
PGP
Sign: F202 79C9 76F7 40BB 54EC 494F 5DEF 1D70 14C1 C4CC
Encrypt: A5B3 1B21 55E1 80AF 4C6E DE83 467B 8EFC 3DEE 681C
Auth: CD55 E8A5 1A08 2933 8BA6 BC88 D81F 1943 739A 3C47

[+] 1 user Likes Reiko's post
Reply

RE: [Ruby] Halcyon V2 #6
I'm so confused.. how is this possibly called an encryption program? This is just taking provided input and modifying each individual character into a static alternate set of characters in the table set for that provided character. What would you even use this for? "Encrypting" some text/program that nobody would even be able to read unless they had this specific program seems beyond useless to me. I'm not bashing on your programming skills, it just seems like downloading and using this program would be a waste of storage space and time. Even using some simple ass OpenSSL::Cipher encryption program would be better.
XMPP - wrath@xmpp.jp

Reply

RE: [Ruby] Halcyon V2 #7
(06-18-2015, 05:32 AM)nothing.nobody Wrote: I'm so confused.. how is this possibly called an encryption program? This is just taking provided input and modifying each individual character into a static alternate set of characters in the table set for that provided character. What would you even use this for? "Encrypting" some text/program that nobody would even be able to read unless they had this specific program seems beyond useless to me. I'm not bashing on your programming skills, it just seems like downloading and using this program would be a waste of storage space and time. Even using some simple ass OpenSSL::Cipher encryption program would be better.

You're not entirely wrong, but it's good as a project. And it's obviously customizable by changing the scan length and keys. This isn't the final product yet, but you're right in saying that it's not the best out there.
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.

Reply

RE: [Ruby] Halcyon V2 #8
(06-18-2015, 05:32 AM)nothing.nobody Wrote: snipped truth

It's classical crypto and it's interesting. Modern crypto beats it by millions of orders of magnitude and everyone knows that. I'm just having fun with breaking it and having @Chitoge improve on it.

As for "needing this specific program to read it", that's not the case at all. I managed to obtain plaintext without using any known key.
PGP
Sign: F202 79C9 76F7 40BB 54EC 494F 5DEF 1D70 14C1 C4CC
Encrypt: A5B3 1B21 55E1 80AF 4C6E DE83 467B 8EFC 3DEE 681C
Auth: CD55 E8A5 1A08 2933 8BA6 BC88 D81F 1943 739A 3C47

Reply

RE: [Ruby] Halcyon V2 #9
(06-18-2015, 06:29 AM)Reiko Wrote: I managed to obtain plaintext without using any known key.

Hush. Nobody needs to know about that. (plus that was 2.0, I've improved it at least sixfold)
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.

Reply