crypt-fog 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGES +6 -0
- data/README +21 -44
- data/Rakefile +22 -22
- data/bin/fogenc +2 -2
- data/crypt-fog.gemspec +24 -0
- data/lib/crypt/fog.rb +1 -1
- data/test/test_crypt_fog.rb +50 -0
- metadata +50 -46
- data/test/tc_fog.rb +0 -46
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 35eb055755ad1545850c5445801a75d238feb3ac
|
4
|
+
data.tar.gz: 0f6a1d205d1de2fd12bd2fc380bfa0be0d101ddc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2010aa9876ccd1a18f66ebad64ed98f821e56ea557e2d439c737721923d00533e23372b53b89fc499dc5ec4a1ac85a169fb9d5d8d67df29af6d74a4c72dad720
|
7
|
+
data.tar.gz: 9e97413911e88184a0152b534fd2d887d35a091a81fbb97ff0954ff35f3bba1e0f9e0ba6a65dc7827d365502de95dd3f1d349a6a84e091547fe28862b86ee3a3
|
data/CHANGES
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
== 1.0.2 - 2-Nov-2014
|
2
|
+
* Changed license to Artistic 2.0.
|
3
|
+
* Some gemspec and Rakefile updates.
|
4
|
+
* Test file renamed to test_crypt_fog.rb.
|
5
|
+
* Some updates to the README.
|
6
|
+
|
1
7
|
== 1.0.1 - 1-Aug-2007
|
2
8
|
* Changed 'quickenc' to 'fogenc'
|
3
9
|
* Now includes a Rakefile with tasks for installation and testing.
|
data/README
CHANGED
@@ -1,62 +1,39 @@
|
|
1
1
|
== Description
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
exchanges, etc.
|
2
|
+
The crypt-fog library is a simple encryption mechanism, but slightly better
|
3
|
+
than Rot13. Its primary goal is to provide a reasonable amount of
|
4
|
+
obfuscation without having to resort to public/private key exchanges, etc.
|
6
5
|
|
7
|
-
|
8
|
-
scheme.
|
6
|
+
For hyper-sensitive data I recommend using a more advanced encryption scheme.
|
9
7
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
In addition to the module, a stand-alone program is included called
|
9
|
+
"fogenc" that takes both a string and a number as arguments and returns
|
10
|
+
your encrypted string. You can then copy/paste that string to a .rc file.
|
11
|
+
Just remember the number you picked in order to decrypt it.
|
14
12
|
|
15
|
-
|
16
|
-
|
13
|
+
Usage: fogenc -s "hello" -d 1688
|
14
|
+
fogenc -f "test.txt" -d 1066
|
17
15
|
|
18
|
-
|
16
|
+
Modify the shebang line as needed.
|
19
17
|
|
20
18
|
== Installation
|
21
|
-
|
22
|
-
rake install (non-gem) rake install_gem (gem)
|
23
|
-
|
24
|
-
== Synopsis
|
25
|
-
include Crypt
|
26
|
-
s = Fog.new("hello",2003)
|
27
|
-
p s # ";8??B"
|
28
|
-
p s.decrypt # "hello"
|
29
|
-
|
30
|
-
Fog.decrypt(";8??B",2003) # "hello"
|
31
|
-
|
32
|
-
== Constants
|
33
|
-
VERSION
|
34
|
-
The current version of the library, returned as a String.
|
19
|
+
gem install crypt-fog
|
35
20
|
|
36
|
-
==
|
37
|
-
|
38
|
-
|
39
|
-
The degree is the value used to obfuscate the string.
|
40
|
-
|
41
|
-
Means of encryption not provided here. You'll have to look at the code. :)
|
21
|
+
== Synopsis
|
22
|
+
require 'crypt/fog'
|
23
|
+
include Crypt
|
42
24
|
|
43
|
-
Fog.
|
44
|
-
|
45
|
-
|
25
|
+
s = Fog.new("hello",2003)
|
26
|
+
p s # ";8??B"
|
27
|
+
p s.decrypt # "hello"
|
46
28
|
|
47
|
-
|
48
|
-
Fog#decrypt
|
49
|
-
Returns a decrypted String, using the degree that was provided during
|
50
|
-
initialization.
|
29
|
+
Fog.decrypt(";8??B",2003) # "hello"
|
51
30
|
|
52
31
|
== License
|
53
|
-
|
32
|
+
Artistic 2.0
|
54
33
|
|
55
34
|
== Copyright
|
56
|
-
(C) 2003-
|
35
|
+
(C) 2003-2014 Daniel J. Berger
|
57
36
|
All rights reserved.
|
58
37
|
|
59
38
|
== Author
|
60
39
|
Daniel J. Berger
|
61
|
-
djberg96 at gmail dot com
|
62
|
-
imperator on IRC (irc.freenode.net)
|
data/Rakefile
CHANGED
@@ -1,31 +1,31 @@
|
|
1
1
|
require 'rake'
|
2
2
|
require 'rake/testtask'
|
3
|
-
|
3
|
+
require 'rake/clean'
|
4
4
|
|
5
|
-
|
6
|
-
task :install do
|
7
|
-
dest = File.join(CONFIG['sitelibdir'], 'crypt')
|
8
|
-
Dir.mkdir(dest) unless File.exists? dest
|
9
|
-
cp 'lib/crypt/fog.rb', dest, :verbose => true
|
10
|
-
cp 'bin/fogenc', CONFIG['bindir'], :verbose => true
|
11
|
-
end
|
5
|
+
CLEAN.include("*.gem", "*.rbc")
|
12
6
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
7
|
+
namespace :gem do
|
8
|
+
desc 'Build the crypt-fog gem'
|
9
|
+
task :create => [:clean] do
|
10
|
+
spec = eval(IO.read('crypt-fog.gemspec'))
|
11
|
+
require 'rubygems/package'
|
12
|
+
if Gem::VERSION < "2.0"
|
13
|
+
Gem::Builder.new(spec).build
|
14
|
+
else
|
15
|
+
Gem::Package.build(spec)
|
16
|
+
end
|
17
|
+
end
|
19
18
|
|
20
|
-
desc
|
21
|
-
task :
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
desc 'Install the crypt-fog library as a gem'
|
20
|
+
task :install => [:create] do
|
21
|
+
file = Dir["*.gem"].first
|
22
|
+
sh "gem install -l #{file}"
|
23
|
+
end
|
25
24
|
end
|
26
25
|
|
27
26
|
Rake::TestTask.new do |t|
|
28
|
-
|
29
|
-
|
30
|
-
t.test_files = FileList['test/tc*']
|
27
|
+
t.warning = true
|
28
|
+
t.verbose = true
|
31
29
|
end
|
30
|
+
|
31
|
+
task :default => :test
|
data/bin/fogenc
CHANGED
@@ -11,9 +11,9 @@
|
|
11
11
|
# implied warranties, including, without limitation, the implied
|
12
12
|
# warranties of merchantability and fitness for a particular purpose.
|
13
13
|
#
|
14
|
-
# License:
|
14
|
+
# License: Artistic 2.0
|
15
15
|
#
|
16
|
-
# Copyright: (C) 2003-
|
16
|
+
# Copyright: (C) 2003-2014 Daniel J. Berger. All rights reserved.
|
17
17
|
#
|
18
18
|
require 'getoptlong'
|
19
19
|
require 'crypt/fog'
|
data/crypt-fog.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
Gem::Specification.new do |gem|
|
4
|
+
gem.name = 'crypt-fog'
|
5
|
+
gem.version = '1.0.2'
|
6
|
+
gem.author = 'Daniel J. Berger'
|
7
|
+
gem.license = 'Artistic 2.0'
|
8
|
+
gem.description = 'A simple string encryption scheme'
|
9
|
+
gem.email = 'djberg96@gmail.com'
|
10
|
+
gem.files = Dir['**/*'].reject{ |f| f.include?('git') }
|
11
|
+
gem.test_files = ['test/test_crypt_fog.rb']
|
12
|
+
gem.homepage = 'https://github.com/djberg96/crypt-fog'
|
13
|
+
|
14
|
+
gem.executables << 'fogenc'
|
15
|
+
|
16
|
+
gem.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST']
|
17
|
+
|
18
|
+
gem.summary = <<-EOF
|
19
|
+
crypt-fog is a simple encryption mechanism, but slightly better
|
20
|
+
than Rot13. It's primary goal is to provide a reasonable amount
|
21
|
+
of obfuscation without having to resort to public/private key
|
22
|
+
exchanges, etc.
|
23
|
+
EOF
|
24
|
+
end
|
data/lib/crypt/fog.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Crypt
|
2
2
|
|
3
|
-
module_eval("\
|
3
|
+
module_eval("\xB2\xBB\xB0\xC2\xC2o\x95\xBE\xB6o\x8Bo\xA2\xC3\xC1\xB8\xBD\xB6Yoo\xA5\x94\xA1\xA2\x98\x9E\x9Do\x8Cov\x80}\x7F}\x81vYYooro\xA1\xB4\xC3\xC4\xC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xB4o\xCC}\xBF\xB0\xB2\xBAwv\x92yvxYoo\xB4\xBD\xB3Y\xB4\xBD\xB3Y".unpack("C*").map{ |e| e += 1969 }.pack("C*"))
|
4
4
|
|
5
5
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
########################################################################
|
2
|
+
# test_crypt_fog.rb
|
3
|
+
#
|
4
|
+
# Test suite for the crypt-fog library. You should run the 'test' rake
|
5
|
+
# task to run this test suite.
|
6
|
+
########################################################################
|
7
|
+
require 'test/unit'
|
8
|
+
require 'crypt/fog'
|
9
|
+
|
10
|
+
class TC_Fog < Test::Unit::TestCase
|
11
|
+
def setup
|
12
|
+
@fog = Crypt::Fog.new('hello')
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_crypt_fog_version
|
16
|
+
assert_equal('1.0.2', Crypt::Fog::VERSION)
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_crypt_fog_constructor_one_argument_form
|
20
|
+
assert_nothing_raised{ Crypt::Fog.new('string') }
|
21
|
+
assert_kind_of(String, Crypt::Fog.new('string'))
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_crypt_fog_constructor_two_argument_form
|
25
|
+
assert_nothing_raised{ Crypt::Fog.new('string', 55) }
|
26
|
+
assert_kind_of(String, Crypt::Fog.new('string', 55))
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_class_decrypt
|
30
|
+
assert_respond_to(Crypt::Fog, :decrypt)
|
31
|
+
assert_nothing_raised{ Crypt::Fog.decrypt('string') }
|
32
|
+
assert_nothing_raised{ Crypt::Fog.decrypt('string', 66) }
|
33
|
+
assert_equal('hello', Crypt::Fog.decrypt(';8??B', 2003))
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_instance_decrypt
|
37
|
+
assert_respond_to(@fog, :decrypt)
|
38
|
+
assert_nothing_raised{ @fog.decrypt }
|
39
|
+
assert_equal('hello', @fog.decrypt)
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_types
|
43
|
+
assert_kind_of(Crypt::Fog, @fog)
|
44
|
+
assert_kind_of(String, @fog.decrypt)
|
45
|
+
end
|
46
|
+
|
47
|
+
def teardown
|
48
|
+
@fog = nil
|
49
|
+
end
|
50
|
+
end
|
metadata
CHANGED
@@ -1,54 +1,58 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.4
|
3
|
-
specification_version: 1
|
1
|
+
--- !ruby/object:Gem::Specification
|
4
2
|
name: crypt-fog
|
5
|
-
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.0.
|
7
|
-
date: 2007-08-01 00:00:00 -06:00
|
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
|
-
email: djberg96@gmail.com
|
12
|
-
homepage: http://www.rubyforge.org/projects/shards
|
13
|
-
rubyforge_project:
|
14
|
-
description: A simple encryption scheme
|
15
|
-
autorequire: crypt/fog
|
16
|
-
default_executable:
|
17
|
-
bindir: bin
|
18
|
-
has_rdoc: true
|
19
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">"
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 0.0.0
|
24
|
-
version:
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.2
|
25
5
|
platform: ruby
|
26
|
-
|
27
|
-
cert_chain:
|
28
|
-
post_install_message:
|
29
|
-
authors:
|
6
|
+
authors:
|
30
7
|
- Daniel J. Berger
|
31
|
-
|
32
|
-
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-11-02 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A simple string encryption scheme
|
14
|
+
email: djberg96@gmail.com
|
15
|
+
executables:
|
16
|
+
- fogenc
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files:
|
19
|
+
- README
|
33
20
|
- CHANGES
|
34
21
|
- MANIFEST
|
35
|
-
|
36
|
-
- Rakefile
|
37
|
-
- test/tc_fog.rb
|
38
|
-
test_files:
|
39
|
-
- test/tc_fog.rb
|
40
|
-
rdoc_options:
|
41
|
-
- --main
|
42
|
-
- README
|
43
|
-
extra_rdoc_files:
|
44
|
-
- README
|
22
|
+
files:
|
45
23
|
- CHANGES
|
46
24
|
- MANIFEST
|
47
|
-
|
48
|
-
-
|
49
|
-
|
50
|
-
|
25
|
+
- README
|
26
|
+
- Rakefile
|
27
|
+
- bin/fogenc
|
28
|
+
- crypt-fog.gemspec
|
29
|
+
- lib/crypt/fog.rb
|
30
|
+
- test/test_crypt_fog.rb
|
31
|
+
homepage: https://github.com/djberg96/crypt-fog
|
32
|
+
licenses:
|
33
|
+
- Artistic 2.0
|
34
|
+
metadata: {}
|
35
|
+
post_install_message:
|
36
|
+
rdoc_options: []
|
37
|
+
require_paths:
|
38
|
+
- lib
|
39
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
51
49
|
requirements: []
|
52
|
-
|
53
|
-
|
54
|
-
|
50
|
+
rubyforge_project:
|
51
|
+
rubygems_version: 2.4.2
|
52
|
+
signing_key:
|
53
|
+
specification_version: 4
|
54
|
+
summary: crypt-fog is a simple encryption mechanism, but slightly better than Rot13. It's
|
55
|
+
primary goal is to provide a reasonable amount of obfuscation without having to
|
56
|
+
resort to public/private key exchanges, etc.
|
57
|
+
test_files:
|
58
|
+
- test/test_crypt_fog.rb
|
data/test/tc_fog.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
#############################
|
2
|
-
# tc_fog.rb
|
3
|
-
#
|
4
|
-
# Test suite for crypt-fog.
|
5
|
-
#############################
|
6
|
-
require "test/unit"
|
7
|
-
require "crypt/fog"
|
8
|
-
include Crypt
|
9
|
-
|
10
|
-
class TC_Fog < Test::Unit::TestCase
|
11
|
-
def setup
|
12
|
-
@fog = Fog.new("hello")
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_version
|
16
|
-
assert_equal('1.0.1', Fog::VERSION)
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_constructor
|
20
|
-
assert_nothing_raised{ Fog.new('string') }
|
21
|
-
assert_nothing_raised{ Fog.new('string', 55) }
|
22
|
-
assert_kind_of(String, Fog.new('string'))
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_class_decrypt
|
26
|
-
assert_respond_to(Fog, :decrypt)
|
27
|
-
assert_nothing_raised{ Fog.decrypt('string') }
|
28
|
-
assert_nothing_raised{ Fog.decrypt('string', 66) }
|
29
|
-
assert_equal('hello', Fog.decrypt(';8??B', 2003))
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_instance_decrypt
|
33
|
-
assert_respond_to(@fog, :decrypt)
|
34
|
-
assert_nothing_raised{ @fog.decrypt }
|
35
|
-
assert_equal('hello', @fog.decrypt)
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_types
|
39
|
-
assert_kind_of(Crypt::Fog, @fog)
|
40
|
-
assert_kind_of(String, @fog.decrypt)
|
41
|
-
end
|
42
|
-
|
43
|
-
def teardown
|
44
|
-
@fog = nil
|
45
|
-
end
|
46
|
-
end
|