![]() |
|
Halcyon text encryptor [Ruby] - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Coding (https://sinister.ly/Forum-Coding) +--- Forum: Coding (https://sinister.ly/Forum-Coding--71) +--- Thread: Halcyon text encryptor [Ruby] (/Thread-Halcyon-text-encryptor-Ruby) |
Halcyon text encryptor [Ruby] - Inori - 01-07-2015 Hello all. After being off for a while, I think it's time to come back with a big project. Halcyon is an encryption system loosely modeled after Enigma from The Imitation game. It's in alpha right now, but I'll update it soon. Enjoy! Halcyon.rb Code: =begin
Halcyon Encryption tool made by RubyRose/__scripted__ , 2015
Halcyon is for educational and recreational purposes only (if you're looking
for some kind of espionage shit, use something else, please.)
If you intend to Post this tool on one site or another, /please/ credit me in one way or another
For information, to report a bug, or just to say thanks, e-mail me at [snip]
=end
# encrypt or decrypt #
#===========================================#
puts "Halcyon Encryptor"
puts " "
puts "[1] Encrypt"
puts "[2] Decrypt"
ed = gets.chomp
# encrypt - input type #
#===========================================#
if ed == "1"
system "cls"
puts "Halcyon Encryptor"
puts " "
puts "[1] Text input"
puts "[2] File input"
intype = gets.chomp
system "cls"
puts "Halcyon Encryptor"
puts " "
# contextual display per input type #
#===========================================#
if intype == "1"
puts "Enter text"
elsif intype == "2"
puts "Enter filepath (.txt support only)"
else
puts "Invalid input"
sleep
end
# filepath or text to be encrypted #
#===========================================#
content = gets.chomp
# processing file/text #
#===========================================#
if intype == "2"
unenc = File.read("#{content}")
elsif intype == "1"
unenc = "#{content}"
else
puts "how did you get here?"
end
# actual encryption process #
#===========================================#
unenc.downcase!
unenc.gsub!(/a/, "86L2" || "IFKP")
unenc.gsub!(/b/, "O9FU" || "C0K8")
unenc.gsub!(/c/, "DGC9" || "JK05")
unenc.gsub!(/d/, "72JE" || "43SL")
unenc.gsub!(/e/, "PT08" || "TY0V")
unenc.gsub!(/f/, "L1WN" || "W3BZ")
unenc.gsub!(/g/, "ZBRX" || "09ZM")
unenc.gsub!(/h/, "33C6" || "ZCSG")
unenc.gsub!(/i/, "FB2M" || "B20H")
unenc.gsub!(/j/, "0LJW" || "FEHX")
unenc.gsub!(/k/, "F6I2" || "AP7T")
unenc.gsub!(/l/, "AJJ5" || "DO6K")
unenc.gsub!(/m/, "EVET" || "3MLE")
unenc.gsub!(/n/, "0SHX" || "PF23")
unenc.gsub!(/o/, "8PUV" || "2NEA")
unenc.gsub!(/p/, "TSVW" || "QW10")
unenc.gsub!(/q/, "XHLV" || "W0Q3")
unenc.gsub!(/r/, "K45G" || "PGPP")
unenc.gsub!(/s/, "H2QV" || "BIR2")
unenc.gsub!(/t/, "620A" || "YPAJ")
unenc.gsub!(/u/, "LY1E" || "B2GD")
unenc.gsub!(/v/, "XEJ4" || "OABY")
unenc.gsub!(/w/, "W8UN" || "UXUW")
unenc.gsub!(/x/, "RKJA" || "GBVO")
unenc.gsub!(/y/, "R06K" || "82GN")
unenc.gsub!(/z/, "32ZG" || "5DJE")
unenc.gsub!(/0/, "P1E1" || "KPC1")
unenc.gsub!(/1/, "UHWX" || "58EP")
unenc.gsub!(/2/, "S9M0" || "B9LJ")
unenc.gsub!(/3/, "QVBZ" || "KE5S")
unenc.gsub!(/4/, "S13P" || "CUL9")
unenc.gsub!(/5/, "I3KN" || "VP1Q")
unenc.gsub!(/6/, "IK9O" || "8H86")
unenc.gsub!(/7/, "8WGY" || "B89U")
unenc.gsub!(/8/, "ACXY" || "CFVY")
unenc.gsub!(/9/, "NGNY" || "RWBY")
unenc.gsub!(/ /, "FUH3" || "JNPR")
# file saving #
#===========================================#
if intype == "2"
output = File.open("#{content}", "w")
output << unenc
output.close
elsif intype == "1"
system "cls"
puts "Halcyon Encryptor"
puts " "
puts "Encrypted text:"
puts "#{unenc}"
sleep
else
puts "wut .-."
end
# decryption menu #
#===========================================#
elsif ed == "2"
i = 0
system "cls"
puts "Halcyon Encryptor"
puts " "
puts "Enter filepath (.txt support only)"
# filepath to be decrypted #
#===========================================#
content = gets.chomp
enc = File.read("#{content}")
while i <= 2 do
# decryption process #
#===========================================#
enc.gsub!(/86L2/, "a")
enc.gsub!(/IFKP/, "a")
enc.gsub!(/O9FU/, "b")
enc.gsub!(/C0K8/, "b")
enc.gsub!(/DGC9/, "c")
enc.gsub!(/JK05/, "c")
enc.gsub!(/72JE/, "d")
enc.gsub!(/43SL/, "d")
enc.gsub!(/PT08/, "e")
enc.gsub!(/TY0V/, "e")
enc.gsub!(/L1WN/, "f")
enc.gsub!(/W3BZ/, "f")
enc.gsub!(/ZBRX/, "g")
enc.gsub!(/09ZM/, "g")
enc.gsub!(/33C6/, "h")
enc.gsub!(/ZCSG/, "h")
enc.gsub!(/FB2M/, "i")
enc.gsub!(/B20H/, "i")
enc.gsub!(/0LJW/, "j")
enc.gsub!(/FEHX/, "j")
enc.gsub!(/F6I2/, "k")
enc.gsub!(/AP7T/, "k")
enc.gsub!(/AJJ5/, "l")
enc.gsub!(/DO6K/, "l")
enc.gsub!(/EVET/, "m")
enc.gsub!(/3MLE/, "m")
enc.gsub!(/0SHX/, "n")
enc.gsub!(/PF23/, "n")
enc.gsub!(/8PUV/, "o")
enc.gsub!(/2NEA/, "o")
enc.gsub!(/TSVW/, "p")
enc.gsub!(/QW10/, "p")
enc.gsub!(/XHLV/, "q")
enc.gsub!(/W0Q3/, "q")
enc.gsub!(/K45G/, "r")
enc.gsub!(/PGPP/, "r")
enc.gsub!(/H2QV/, "s")
enc.gsub!(/BIR2/, "s")
enc.gsub!(/620A/, "t")
enc.gsub!(/YPAJ/, "t")
enc.gsub!(/LY1E/, "u")
enc.gsub!(/B2GD/, "u")
enc.gsub!(/XEJ4/, "v")
enc.gsub!(/OABY/, "v")
enc.gsub!(/W8UN/, "w")
enc.gsub!(/UXUW/, "w")
enc.gsub!(/RKJA/, "x")
enc.gsub!(/GBVO/, "x")
enc.gsub!(/R06K/, "y")
enc.gsub!(/82GN/, "y")
enc.gsub!(/32ZG/, "z")
enc.gsub!(/5DJE/, "z")
enc.gsub!(/P1E1/, "0")
enc.gsub!(/KPC1/, "0")
enc.gsub!(/UHWX/, "1")
enc.gsub!(/58EP/, "1")
enc.gsub!(/S9M0/, "2")
enc.gsub!(/B9LJ/, "2")
enc.gsub!(/QVBZ/, "3")
enc.gsub!(/KE5S/, "3")
enc.gsub!(/S13P/, "4")
enc.gsub!(/CUL9/, "4")
enc.gsub!(/I3KN/, "5")
enc.gsub!(/VP1Q/, "5")
enc.gsub!(/IK9O/, "6")
enc.gsub!(/8H86/, "6")
enc.gsub!(/8WGY/, "7")
enc.gsub!(/B89U/, "7")
enc.gsub!(/ACXY/, "8")
enc.gsub!(/CFVY/, "8")
enc.gsub!(/NGNY/, "9")
enc.gsub!(/RWBY/, "9")
enc.gsub!(/FUH3/, " ")
enc.gsub!(/JNPR/, " ")
i = i + 1
end
# file saving #
#===========================================#
output = File.open("#{content}", "w")
output << enc
output.close
# you fucked up if you get this #
#===========================================#
else
system "exit"
endRE: Halcyon text encryptor [Ruby] - phyrrus9 - 01-07-2015 So...its a poorly coded, windows only version of sed. I suggest you look into real crypto. RE: Halcyon text encryptor [Ruby] - Inori - 01-07-2015 (01-07-2015, 04:17 PM)phyrrus9 Wrote: So...its a poorly coded, windows only version of sed. I suggest you look into real crypto. As I said, it's alpha. Big updates are coming. RE: Halcyon text encryptor [Ruby] - Nebulous - 01-08-2015 (01-07-2015, 11:45 PM)RubyRose Wrote: As I said, it's alpha. Big updates are coming. You don't know what the difference between alpha and beta is, do you? RE: Halcyon text encryptor [Ruby] - Inori - 01-08-2015 (01-08-2015, 12:05 AM)Nebulous Wrote: You don't know what the difference between alpha and beta is, do you? In traditional software engineering, Alpha releases will still be introducing new features, while Beta releases will see no new features, but rather polishing up the existing stuff. If my understanding is correct, this is alpha seeing as I've been working on it for a while and it's already been posted elsewhere. RE: Halcyon text encryptor [Ruby] - phyrrus9 - 01-12-2015 (01-08-2015, 01:55 AM)RubyRose Wrote: In traditional software engineering, Alpha releases will still be introducing new features, while Beta releases will see no new features, but rather polishing up the existing stuff. If my understanding is correct, this is alpha seeing as I've been working on it for a while and it's already been posted elsewhere. Your understanding is flawed. It has more to deal with the stability of the application as well as features. Most software never undergoes a public alpha phase. Also, you have a long way to go on this, as it seriously is painfully useless. |