Sha256: fbf3f5d277f0f53c609eb283572b19f791d6fe7e051f70ffb7233c84b903e461
Contents?: true
Size: 1.31 KB
Versions: 1
Compression:
Stored size: 1.31 KB
Contents
$:.unshift Dir.pwd + "/lib" require "getoptlong" require "crypt/fog" include Crypt QUICKENC_VERSION = 1.0 def usage print <<-HELP Usage: quickenc -f <filename> -d <salt> quickenc -s <string> -d <salt> HELP exit end args = GetoptLong.new( ["--file", "-f", GetoptLong::OPTIONAL_ARGUMENT], ["--degree", "-d", GetoptLong::REQUIRED_ARGUMENT], ["--string", "-s", GetoptLong::OPTIONAL_ARGUMENT], ["--version", "-v", GetoptLong::NO_ARGUMENT], ["--help", "-h", GetoptLong::NO_ARGUMENT] ) opts = {} begin args.each{ |option,value| opts[option] = value || true } rescue GetoptLong::InvalidOption usage() exit end if opts["--version"] puts "VERSION: " + QUICKENC_VERSION.to_s exit end if opts["--help"] usage() end unless opts["--file"] || opts["--string"] STDERR.puts "Must provide string or file name" usage() end unless opts["--degree"] STDERR.puts "Must provide a degree of salt" usage() end str = nil if opts["--file"] str = IO.readlines(opts["--file"]).flatten.to_s.chomp else str = opts["--string"] end salt = opts["--degree"].to_i puts puts "Copy and paste the string below to wherever you need it" puts "Remember your salt number (#{salt}) in order to decrypt it later on." puts "=" * 63 puts puts "Crypted string: " + Fog.new(str,salt).to_s puts
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
crypt-fog-0.1.0 | bin/quickenc |