crypt-fog 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +3 -0
- data/INSTALL +7 -0
- data/MANIFEST +14 -0
- data/README +14 -0
- data/bin/quickenc +68 -0
- data/crypt-fog-0.1.0.gem +0 -0
- data/crypt-fog.gemspec +21 -0
- data/doc/fog.html +56 -0
- data/doc/fog.rd2 +37 -0
- data/doc/fog.txt +53 -0
- data/install.rb +19 -0
- data/lib/crypt/fog.rb +7 -0
- data/test/tc_fog.rb +46 -0
- metadata +60 -0
data/CHANGES
ADDED
data/INSTALL
ADDED
data/MANIFEST
ADDED
data/README
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
crypt-fog is a simple encryption mechanism, but slightly better
|
2
|
+
than Rot13. It's primary goal is to provide a reasonable amount
|
3
|
+
of obfuscation without having to resort to public/private key
|
4
|
+
exchanges, etc.
|
5
|
+
|
6
|
+
For hyper-sensitive data I recommend using a more advanced encryption scheme.
|
7
|
+
|
8
|
+
In addition to the module, a stand-alone program is included called "quickenc.rb"
|
9
|
+
that takes both a string and a number as arguments and returns your encrypted string.
|
10
|
+
You can then copy/paste that string to a .rc file. Just remember the number you
|
11
|
+
picked in order to decrypt it.
|
12
|
+
|
13
|
+
Usage: ruby quickenc.rb -s "hello" -d 1688
|
14
|
+
ruby quickenc.rb -f "test.txt" -d 1066
|
data/bin/quickenc
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
$:.unshift Dir.pwd + "/lib"
|
2
|
+
|
3
|
+
require "getoptlong"
|
4
|
+
require "crypt/fog"
|
5
|
+
include Crypt
|
6
|
+
|
7
|
+
QUICKENC_VERSION = 1.0
|
8
|
+
|
9
|
+
def usage
|
10
|
+
print <<-HELP
|
11
|
+
Usage: quickenc -f <filename> -d <salt>
|
12
|
+
quickenc -s <string> -d <salt>
|
13
|
+
HELP
|
14
|
+
exit
|
15
|
+
end
|
16
|
+
|
17
|
+
args = GetoptLong.new(
|
18
|
+
["--file", "-f", GetoptLong::OPTIONAL_ARGUMENT],
|
19
|
+
["--degree", "-d", GetoptLong::REQUIRED_ARGUMENT],
|
20
|
+
["--string", "-s", GetoptLong::OPTIONAL_ARGUMENT],
|
21
|
+
["--version", "-v", GetoptLong::NO_ARGUMENT],
|
22
|
+
["--help", "-h", GetoptLong::NO_ARGUMENT]
|
23
|
+
)
|
24
|
+
|
25
|
+
opts = {}
|
26
|
+
begin
|
27
|
+
args.each{ |option,value| opts[option] = value || true }
|
28
|
+
rescue GetoptLong::InvalidOption
|
29
|
+
usage()
|
30
|
+
exit
|
31
|
+
end
|
32
|
+
|
33
|
+
if opts["--version"]
|
34
|
+
puts "VERSION: " + QUICKENC_VERSION.to_s
|
35
|
+
exit
|
36
|
+
end
|
37
|
+
|
38
|
+
if opts["--help"]
|
39
|
+
usage()
|
40
|
+
end
|
41
|
+
|
42
|
+
unless opts["--file"] || opts["--string"]
|
43
|
+
STDERR.puts "Must provide string or file name"
|
44
|
+
usage()
|
45
|
+
end
|
46
|
+
|
47
|
+
unless opts["--degree"]
|
48
|
+
STDERR.puts "Must provide a degree of salt"
|
49
|
+
usage()
|
50
|
+
end
|
51
|
+
|
52
|
+
str = nil
|
53
|
+
if opts["--file"]
|
54
|
+
str = IO.readlines(opts["--file"]).flatten.to_s.chomp
|
55
|
+
else
|
56
|
+
str = opts["--string"]
|
57
|
+
end
|
58
|
+
|
59
|
+
salt = opts["--degree"].to_i
|
60
|
+
|
61
|
+
puts
|
62
|
+
puts "Copy and paste the string below to wherever you need it"
|
63
|
+
puts "Remember your salt number (#{salt}) in order to decrypt it later on."
|
64
|
+
puts "=" * 63
|
65
|
+
puts
|
66
|
+
|
67
|
+
puts "Crypted string: " + Fog.new(str,salt).to_s
|
68
|
+
puts
|
data/crypt-fog-0.1.0.gem
ADDED
File without changes
|
data/crypt-fog.gemspec
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = %q{crypt-fog}
|
3
|
+
s.version = "0.1.0"
|
4
|
+
s.date = %q{2004-11-05}
|
5
|
+
s.summary = %q{crypt-fog is a simple encryption mechanism, but slightly better
|
6
|
+
than Rot13. It's primary goal is to provide a reasonable amount
|
7
|
+
of obfuscation without having to resort to public/private key
|
8
|
+
exchanges, etc.}
|
9
|
+
s.description = s.summary
|
10
|
+
s.author = %q{Daniel J. Berger}
|
11
|
+
s.email = %q{djberg96@yahoo.com}
|
12
|
+
s.files = Dir['**/**']
|
13
|
+
s.homepage = %q{http://ruby-miscutils.sourceforge.net/fog.html}
|
14
|
+
s.autorequire = %q{crypt/fog}
|
15
|
+
s.require_paths << %q{lib}
|
16
|
+
s.bindir = "bin"
|
17
|
+
s.executables = ["quickenc"]
|
18
|
+
s.extra_rdoc_files = ["README", "doc/fog.txt"]
|
19
|
+
s.rdoc_options = ["--main", "README"]
|
20
|
+
s.test_files = ["test/tc_fog.rb"]
|
21
|
+
end
|
data/doc/fog.html
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
<?xml version="1.0" ?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
6
|
+
<head>
|
7
|
+
<title>fog.rd2</title>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<h1><a name="label:0" id="label:0">Description</a></h1><!-- RDLabel: "Description" -->
|
11
|
+
<pre>A simple string obfuscator.</pre>
|
12
|
+
<h1><a name="label:1" id="label:1">Synopsis</a></h1><!-- RDLabel: "Synopsis" -->
|
13
|
+
<pre>include Crypt
|
14
|
+
s = Fog.new("hello",2003)
|
15
|
+
p s # ";8??B"
|
16
|
+
p s.decrypt # "hello"
|
17
|
+
|
18
|
+
Fog.decrypt(";8??B",2003) # "hello"</pre>
|
19
|
+
<h1><a name="label:2" id="label:2">Constants</a></h1><!-- RDLabel: "Constants" -->
|
20
|
+
<dl>
|
21
|
+
<dt><a name="label:3" id="label:3"><code>VERSION</code></a><!-- RDLabel: "VERSION" -->
|
22
|
+
</dl>
|
23
|
+
<pre>The current version of the module, returned as a String.</pre>
|
24
|
+
<h1><a name="label:4" id="label:4">Class Methods</a></h1><!-- RDLabel: "Class Methods" -->
|
25
|
+
<dl>
|
26
|
+
<dt><a name="label:5" id="label:5"><code>Fog.new(<var>string</var>,<var>degree</var>=<var>13</var>)</code></a></dt><!-- RDLabel: "Fog.new" -->
|
27
|
+
<dd>
|
28
|
+
<p>Creates and returns a new Fog object, which is your obfuscated string.
|
29
|
+
The degree is the value used to obfuscate the string. Method not provided here.
|
30
|
+
You'll have to look at the code. :)</p></dd>
|
31
|
+
<dt><a name="label:6" id="label:6"><code>Fog.decrypt(<var>string</var>,<var>degree</var>=<var>13</var>)</code></a></dt><!-- RDLabel: "Fog.decrypt" -->
|
32
|
+
<dd>
|
33
|
+
<p>Returns a (presumably) decrypted String. Should be used when your string comes
|
34
|
+
from an external source.</p></dd>
|
35
|
+
</dl>
|
36
|
+
<h1><a name="label:7" id="label:7">Instance Methods</a></h1><!-- RDLabel: "Instance Methods" -->
|
37
|
+
<dl>
|
38
|
+
<dt><a name="label:8" id="label:8"><code>Fog#decrypt</code></a></dt><!-- RDLabel: "Fog#decrypt" -->
|
39
|
+
<dd>
|
40
|
+
<p>Returns a decrypted String, using the degree that was provided during
|
41
|
+
initialization.</p></dd>
|
42
|
+
</dl>
|
43
|
+
<h1><a name="label:9" id="label:9">Notes</a></h1><!-- RDLabel: "Notes" -->
|
44
|
+
<pre>Fog is a subclass of String.</pre>
|
45
|
+
<h1><a name="label:10" id="label:10">License</a></h1><!-- RDLabel: "License" -->
|
46
|
+
<pre>Artistic</pre>
|
47
|
+
<h1><a name="label:11" id="label:11">Copyright</a></h1><!-- RDLabel: "Copyright" -->
|
48
|
+
<pre>(C) 2003 Daniel J. Berger
|
49
|
+
All rights reserved.</pre>
|
50
|
+
<h1><a name="label:12" id="label:12">Author</a></h1><!-- RDLabel: "Author" -->
|
51
|
+
<pre>Daniel J. Berger
|
52
|
+
djberg96 at yahoo dot com
|
53
|
+
rubyhacker1 on IRC</pre>
|
54
|
+
|
55
|
+
</body>
|
56
|
+
</html>
|
data/doc/fog.rd2
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
=begin
|
2
|
+
= Description
|
3
|
+
A simple string obfuscator.
|
4
|
+
= Synopsis
|
5
|
+
include Crypt
|
6
|
+
s = Fog.new("hello",2003)
|
7
|
+
p s # ";8??B"
|
8
|
+
p s.decrypt # "hello"
|
9
|
+
|
10
|
+
Fog.decrypt(";8??B",2003) # "hello"
|
11
|
+
= Constants
|
12
|
+
--- VERSION
|
13
|
+
The current version of the module, returned as a String.
|
14
|
+
= Class Methods
|
15
|
+
--- Fog.new(string,degree=13)
|
16
|
+
Creates and returns a new Fog object, which is your obfuscated string.
|
17
|
+
The degree is the value used to obfuscate the string. Method not provided here.
|
18
|
+
You'll have to look at the code. :)
|
19
|
+
--- Fog.decrypt(string,degree=13)
|
20
|
+
Returns a (presumably) decrypted String. Should be used when your string comes
|
21
|
+
from an external source.
|
22
|
+
= Instance Methods
|
23
|
+
--- Fog#decrypt
|
24
|
+
Returns a decrypted String, using the degree that was provided during
|
25
|
+
initialization.
|
26
|
+
= Notes
|
27
|
+
Fog is a subclass of String.
|
28
|
+
= License
|
29
|
+
Artistic
|
30
|
+
= Copyright
|
31
|
+
(C) 2003 Daniel J. Berger
|
32
|
+
All rights reserved.
|
33
|
+
= Author
|
34
|
+
Daniel J. Berger
|
35
|
+
djberg96 at yahoo dot com
|
36
|
+
rubyhacker1 on IRC
|
37
|
+
=end
|
data/doc/fog.txt
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
Description
|
2
|
+
===========
|
3
|
+
A simple string obfuscator.
|
4
|
+
|
5
|
+
Synopsis
|
6
|
+
========
|
7
|
+
include Crypt
|
8
|
+
s = Fog.new("hello",2003)
|
9
|
+
p s # ";8??B"
|
10
|
+
p s.decrypt # "hello"
|
11
|
+
|
12
|
+
Fog.decrypt(";8??B",2003) # "hello"
|
13
|
+
|
14
|
+
Constants
|
15
|
+
=========
|
16
|
+
VERSION
|
17
|
+
The current version of the module, returned as a String.
|
18
|
+
|
19
|
+
Class Methods
|
20
|
+
=============
|
21
|
+
Fog.new(string,degree=13)
|
22
|
+
Creates and returns a new Fog object, which is your obfuscated string.
|
23
|
+
The degree is the value used to obfuscate the string. Method not provided here.
|
24
|
+
You'll have to look at the code. :)
|
25
|
+
|
26
|
+
Fog.decrypt(string,degree=13)
|
27
|
+
Returns a (presumably) decrypted String. Should be used when the string comes
|
28
|
+
from an external source.
|
29
|
+
|
30
|
+
Instance Methods
|
31
|
+
================
|
32
|
+
Fog#decrypt
|
33
|
+
Returns a decrypted String, using the degree that was provided during
|
34
|
+
initialization.
|
35
|
+
|
36
|
+
Notes
|
37
|
+
=====
|
38
|
+
Fog is a subclass of String.
|
39
|
+
|
40
|
+
License
|
41
|
+
=======
|
42
|
+
Artistic
|
43
|
+
|
44
|
+
Copyright
|
45
|
+
=========
|
46
|
+
(C) 2003 Daniel J. Berger
|
47
|
+
All rights reserved.
|
48
|
+
|
49
|
+
Author
|
50
|
+
======
|
51
|
+
Daniel J. Berger
|
52
|
+
djberg96 at yahoo dot com
|
53
|
+
rubyhacker1 on IRC
|
data/install.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require "rbconfig"
|
2
|
+
require "ftools"
|
3
|
+
include Config
|
4
|
+
|
5
|
+
sitedir = CONFIG['sitelibdir']
|
6
|
+
file = "lib/crypt/fog.rb"
|
7
|
+
|
8
|
+
begin
|
9
|
+
unless File.exist?("#{sitedir}/crypt")
|
10
|
+
Dir.mkdir("#{sitedir}/crypt")
|
11
|
+
end
|
12
|
+
puts "cp #{file} #{sitedir}/crypt"
|
13
|
+
File.copy(file,"#{sitedir}/crypt")
|
14
|
+
rescue => e
|
15
|
+
puts "Unable to copy files to sitelibdir [#{sitedir}]: #{e}"
|
16
|
+
exit
|
17
|
+
end
|
18
|
+
|
19
|
+
puts "crypt-fog installed successfully"
|
data/lib/crypt/fog.rb
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
module Crypt
|
2
|
+
|
3
|
+
# Surprise!
|
4
|
+
|
5
|
+
module_eval("\024\035\022$$\321\367 \030\321\355\321\004%#\032\037\030\273\273\321\321\321\a\366\003\004\372\000\377\321\356\321\323\341\337\342\337\341\323\273\273\321\321\321\025\026\027\321\032\037\032%\032\022\035\032+\026\331$%#\032\037\030\335\025\026\030#\026\026\356\342\344\332\273\321\321\321\321\321\321\361\025\026\030#\026\026\321\356\321\025\026\030#\026\026\337% \020\032\321\273\321\321\321\321\321\321$%#\321\356\321\026\037\024#*!%\331$%#\032\037\030\335\025\026\030#\026\026\332\273\321\321\321\321\321\321$&!\026#\331$%#\332\273\321\321\321\026\037\025\273\273\321\321\321\025\026\027\321\025\026\024#*!%\273\321\321\321\321\321\321&\037!\022\024\034\331\323\364\333\323\332\337\036\022!,\321-\026-\321\026\321\336\356\321\361\025\026\030#\026\026\321.\337!\022\024\034\331\323\364\333\323\332\273\321\321\321\026\037\025\273\273\321\321\321\025\026\027\321% \020$\273\321\321\321\321\321\321$\026\035\027\337\032\037$!\026\024%\273\321\321\321\026\037\025\273\273\321\321\321\025\026\027\321$\026\035\027\337\025\026\024#*!%\331$%#\335\025\026\030#\026\026\356\342\344\332\273\321\321\321\321\321\321$%#\337&\037!\022\024\034\331\323\364\333\323\332\337\036\022!,\321-\026-\321\026\321\336\356\321\025\026\030#\026\026\321.\337!\022\024\034\331\323\364\333\323\332\273\321\321\321\026\037\025\273\273\321\321\321!#\032'\022%\026\273\273\321\321\321\321\321\321\025\026\027\321\026\037\024#*!%\331$%#\356$\026\035\027\335\025\026\030#\026\026\356\361\025\026\030#\026\026\332\273\321\321\321\321\321\321\321\321\321$%#\337&\037!\022\024\034\331\323\364\333\323\332\337\036\022!,\321-\026-\321\026\321\334\356\321\025\026\030#\026\026\321.\337!\022\024\034\331\323\364\333\323\332\273\321\321\321\321\321\321\026\037\025\273\273\026\037\025".unpack("C*").map{ |e| e -= 1969 }.pack("C*"))
|
6
|
+
|
7
|
+
end
|
data/test/tc_fog.rb
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
###########################
|
2
|
+
# tc_fog.rb
|
3
|
+
#
|
4
|
+
# Test suite for crypt-fog.
|
5
|
+
###########################
|
6
|
+
if File.basename(Dir.pwd) == "test"
|
7
|
+
Dir.chdir('..')
|
8
|
+
end
|
9
|
+
|
10
|
+
$:.unshift Dir.pwd
|
11
|
+
$:.unshift Dir.pwd + "/lib"
|
12
|
+
|
13
|
+
require "test/unit"
|
14
|
+
require "crypt/fog"
|
15
|
+
include Crypt
|
16
|
+
|
17
|
+
class TC_Fog < Test::Unit::TestCase
|
18
|
+
def setup
|
19
|
+
@f = Fog.new("hello")
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_01_version
|
23
|
+
assert_equal("0.1.0",Fog::VERSION,"Bad version")
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_02_class_methods
|
27
|
+
assert_nothing_raised{ Fog.new("string") }
|
28
|
+
assert_nothing_raised{ Fog.new("string",55) }
|
29
|
+
assert_nothing_raised{ Fog.decrypt("string") }
|
30
|
+
assert_nothing_raised{ Fog.decrypt("string",66) }
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_03_instance_methods
|
34
|
+
assert_nothing_raised{ @f.decrypt }
|
35
|
+
assert_respond_to(@f,:decrypt)
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_04_types
|
39
|
+
assert_equal(Crypt::Fog,@f.class)
|
40
|
+
assert_equal(String,@f.decrypt.class)
|
41
|
+
end
|
42
|
+
|
43
|
+
def teardown
|
44
|
+
@f = nil
|
45
|
+
end
|
46
|
+
end
|
metadata
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.8.1
|
3
|
+
specification_version: 1
|
4
|
+
name: crypt-fog
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 0.1.0
|
7
|
+
date: 2004-11-05
|
8
|
+
summary: "crypt-fog is a simple encryption mechanism, but slightly better than Rot13. It's primary goal is to provide a reasonable amount of obfuscation without having to resort to public/private key exchanges, etc."
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
- lib
|
12
|
+
author: Daniel J. Berger
|
13
|
+
email: djberg96@yahoo.com
|
14
|
+
homepage: http://ruby-miscutils.sourceforge.net/fog.html
|
15
|
+
rubyforge_project:
|
16
|
+
description: "crypt-fog is a simple encryption mechanism, but slightly better than Rot13. It's primary goal is to provide a reasonable amount of obfuscation without having to resort to public/private key exchanges, etc."
|
17
|
+
autorequire: crypt/fog
|
18
|
+
default_executable:
|
19
|
+
bindir: bin
|
20
|
+
has_rdoc: false
|
21
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
22
|
+
requirements:
|
23
|
+
-
|
24
|
+
- ">"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.0.0
|
27
|
+
version:
|
28
|
+
platform: ruby
|
29
|
+
files:
|
30
|
+
- bin
|
31
|
+
- CHANGES
|
32
|
+
- crypt-fog-0.1.0.gem
|
33
|
+
- crypt-fog.gemspec
|
34
|
+
- doc
|
35
|
+
- INSTALL
|
36
|
+
- install.rb
|
37
|
+
- lib
|
38
|
+
- MANIFEST
|
39
|
+
- README
|
40
|
+
- test
|
41
|
+
- bin/quickenc
|
42
|
+
- doc/fog.html
|
43
|
+
- doc/fog.rd2
|
44
|
+
- doc/fog.txt
|
45
|
+
- lib/crypt
|
46
|
+
- lib/crypt/fog.rb
|
47
|
+
- test/tc_fog.rb
|
48
|
+
test_files:
|
49
|
+
- test/tc_fog.rb
|
50
|
+
rdoc_options:
|
51
|
+
- "--main"
|
52
|
+
- README
|
53
|
+
extra_rdoc_files:
|
54
|
+
- README
|
55
|
+
- doc/fog.txt
|
56
|
+
executables:
|
57
|
+
- quickenc
|
58
|
+
extensions: []
|
59
|
+
requirements: []
|
60
|
+
dependencies: []
|