crypt-rot13 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +2 -0
- data/CHANGES +6 -0
- data/MANIFEST +2 -0
- data/README +3 -4
- data/Rakefile +4 -2
- data/certs/djberg96_pub.pem +21 -0
- data/crypt-rot13.gemspec +13 -13
- data/lib/crypt/rot13.rb +41 -41
- data/lib/crypt-rot13.rb +1 -0
- data/test/test_crypt_rot13.rb +58 -58
- data.tar.gz.sig +0 -0
- metadata +55 -44
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7edffffcde92082564183071793f82c90b8aef39
|
4
|
+
data.tar.gz: c229b100f4b98c633e93c4734884e3b93adf5817
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b33e5f7b53ebba95f59d2e2e682f5eeb2181a1d0a78f9a5bc5990612e5e0d916b2826c56689b5b1f322d4e71a8160ccf5db492c8815652b0ca2d96d3c4bd2639
|
7
|
+
data.tar.gz: 3d31449e505577cc080cf450068d08d4c56f306194cc827ba6de80705eb78b1a5729bb387d09d4ad3f683768e9b9c9646502d6121dde8deb92babeb57c542549
|
checksums.yaml.gz.sig
ADDED
data/CHANGES
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
== 1.0.6 - 15-Jan-2016
|
2
|
+
* This gem is now signed.
|
3
|
+
* The gem related tasks in the Rakefile now assume Rubygems 2.x.
|
4
|
+
* Updates to the gemspec.
|
5
|
+
* Added a crypt-rot13.rb file for convenience.
|
6
|
+
|
1
7
|
== 1.0.5 - 1-Sep-2011
|
2
8
|
* Refactored the Rakefile removing an old install task, adding
|
3
9
|
a clean task, and setting a default task.
|
data/MANIFEST
CHANGED
data/README
CHANGED
@@ -23,16 +23,15 @@
|
|
23
23
|
and most simple, encryption schemes. Hail Caesar!
|
24
24
|
|
25
25
|
= Known Bugs
|
26
|
-
None that I'm aware of.
|
26
|
+
None that I'm aware of. Please log any bugs you find on the project page at:
|
27
27
|
|
28
|
-
|
29
|
-
http://www.rubyforge.org/projects/shards.
|
28
|
+
https://github.com/djberg96/crypt-rot13
|
30
29
|
|
31
30
|
= License
|
32
31
|
Artistic 2.0
|
33
32
|
|
34
33
|
= Copyright
|
35
|
-
(C) 2005-
|
34
|
+
(C) 2005-2016, Daniel J. Berger, All Rights Reserved
|
36
35
|
|
37
36
|
= Warranty
|
38
37
|
This package is provided "as is" and without any express or
|
data/Rakefile
CHANGED
@@ -7,14 +7,16 @@ CLEAN.include("**/*.gem", "**/*.rbc")
|
|
7
7
|
namespace :gem do
|
8
8
|
desc 'Create the crypt-rot13 gem'
|
9
9
|
task :create => [:clean] do
|
10
|
+
require 'rubygems/package'
|
10
11
|
spec = eval(IO.read('crypt-rot13.gemspec'))
|
11
|
-
|
12
|
+
spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem')
|
13
|
+
Gem::Package.build(spec, true)
|
12
14
|
end
|
13
15
|
|
14
16
|
desc 'Install the crypt-rot13 gem'
|
15
17
|
task :install => [:create] do
|
16
18
|
file = Dir["*.gem"].first
|
17
|
-
sh "gem install #{file}"
|
19
|
+
sh "gem install -l #{file}"
|
18
20
|
end
|
19
21
|
end
|
20
22
|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
2
|
+
MIIDcDCCAligAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MREwDwYDVQQDDAhkamJl
|
3
|
+
cmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t
|
4
|
+
MB4XDTE1MDkwMjIwNDkxOFoXDTE2MDkwMTIwNDkxOFowPzERMA8GA1UEAwwIZGpi
|
5
|
+
ZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkW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KM=
|
21
|
+
-----END CERTIFICATE-----
|
data/crypt-rot13.gemspec
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
|
3
|
-
Gem::Specification.new do |
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = 'crypt-rot13'
|
5
|
+
spec.version = '1.0.6'
|
6
|
+
spec.author = 'Daniel J. Berger'
|
7
|
+
spec.license = 'Artistic 2.0'
|
8
|
+
spec.email = 'djberg96@gmail.com'
|
9
|
+
spec.homepage = 'http://github.com/djberg96/crypt-rot13'
|
10
|
+
spec.summary = 'Character rotation encryption, i.e. Caesar Cipher'
|
11
|
+
spec.test_file = 'test/test_crypt_rot13.rb'
|
12
|
+
spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
|
13
|
+
spec.cert_chain = Dir['certs/*']
|
13
14
|
|
14
|
-
|
15
|
-
gem.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST']
|
15
|
+
spec.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST']
|
16
16
|
|
17
|
-
|
17
|
+
spec.description = <<-EOF
|
18
18
|
The crypt-rot13 library provides an interface for a simple character
|
19
19
|
substitution cipher known as ROT13, a variation on the Caesar cipher.
|
20
20
|
EOF
|
data/lib/crypt/rot13.rb
CHANGED
@@ -1,53 +1,53 @@
|
|
1
1
|
# The Crypt module serves as a namespace only.
|
2
2
|
module Crypt
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
# The Rot13 class encapsulates methods governing character rotation.
|
5
|
+
class Rot13 < String
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
# The Rot13::Error class is raised if an illegal rotation value is used.
|
8
|
+
class Error < ArgumentError; end
|
9
9
|
|
10
|
-
|
11
|
-
|
10
|
+
# The version of the crypt-rot13 library.
|
11
|
+
VERSION = '1.0.6'
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
13
|
+
# Returns a new Rot13 object. The object is a string with the letters
|
14
|
+
# each rotated by +degree+.
|
15
|
+
#
|
16
|
+
# You cannot use a multiple of 26 as the degree or a Rot13::Error will
|
17
|
+
# be raised. So, your days of double rot13 encryption are over.
|
18
|
+
#
|
19
|
+
def initialize(str='', degree=13)
|
20
|
+
str = rotate_string(str, degree) unless str.empty?
|
21
|
+
super(str)
|
22
|
+
end
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
# Rotates the Crypt::Rot13 object by +degree+.
|
25
|
+
#
|
26
|
+
def rotate(degree)
|
27
|
+
rotate_string(self, degree)
|
28
|
+
end
|
29
29
|
|
30
|
-
|
30
|
+
private
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
32
|
+
def rotate_string(str, degree)
|
33
|
+
case degree.modulo(26)
|
34
|
+
when 0
|
35
|
+
raise Error, 'degree must not be a multiple of 26'
|
36
|
+
when 13
|
37
|
+
str = str.tr('a-zA-Z', 'n-za-mN-ZA-M')
|
38
|
+
else
|
39
|
+
str = str.unpack('C' * str.length).map!{ |e|
|
40
|
+
if e >= 97 && e <= 122
|
41
|
+
e = ((e - 97 + degree) % 26) + 97
|
42
|
+
elsif e >= 65 && e <= 90
|
43
|
+
e = ((e - 65 + degree) % 26) + 65
|
38
44
|
else
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
elsif e >= 65 && e <= 90
|
43
|
-
e = ((e - 65 + degree) % 26) + 65
|
44
|
-
else
|
45
|
-
e = e
|
46
|
-
end
|
47
|
-
}.pack('C' * str.length)
|
48
|
-
end
|
49
|
-
|
50
|
-
str
|
45
|
+
e = e
|
46
|
+
end
|
47
|
+
}.pack('C' * str.length)
|
51
48
|
end
|
52
|
-
|
49
|
+
|
50
|
+
str
|
51
|
+
end
|
52
|
+
end
|
53
53
|
end
|
data/lib/crypt-rot13.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require_relative 'crypt/rot13'
|
data/test/test_crypt_rot13.rb
CHANGED
@@ -9,71 +9,71 @@ require 'test/unit'
|
|
9
9
|
include Crypt
|
10
10
|
|
11
11
|
class TC_Rot13 < Test::Unit::TestCase
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
12
|
+
def setup
|
13
|
+
@r1 = Rot13.new('abc')
|
14
|
+
@r2 = Rot13.new('ABC')
|
15
|
+
@r3 = Rot13.new('xyz')
|
16
|
+
@r4 = Rot13.new('XYZ')
|
17
|
+
@r5 = Rot13.new('a1b2c3@#$')
|
18
|
+
@r6 = Rot13.new('abc', 3)
|
19
|
+
@r7 = Rot13.new('ABC', 3)
|
20
|
+
@r8 = Rot13.new('xyz', 23)
|
21
|
+
@r9 = Rot13.new('XYZ', 23)
|
22
|
+
end
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
def test_version
|
25
|
+
assert_equal('1.0.6', Rot13::VERSION)
|
26
|
+
end
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
28
|
+
def test_constructor
|
29
|
+
assert_respond_to(Rot13,:new)
|
30
|
+
assert_nothing_raised{ Rot13.new }
|
31
|
+
assert_nothing_raised{ Rot13.new('foo') }
|
32
|
+
assert_nothing_raised{ Rot13.new('foo', 7) }
|
33
|
+
end
|
34
34
|
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
def test_available_methods
|
36
|
+
assert_respond_to(@r1, :rotate)
|
37
|
+
end
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
39
|
+
def test_degree
|
40
|
+
assert_raises(Rot13::Error){ Rot13.new('foo', 26) }
|
41
|
+
assert_raises(Rot13::Error){ Rot13.new('foo', 52) }
|
42
|
+
assert_nothing_raised{ Rot13.new('foo', 25) }
|
43
|
+
end
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
45
|
+
def test_string_class
|
46
|
+
assert_kind_of(String, @r1)
|
47
|
+
end
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
49
|
+
def test_return_value_default_degree
|
50
|
+
assert_equal('nop', @r1)
|
51
|
+
assert_equal('NOP', @r2)
|
52
|
+
assert_equal('klm', @r3)
|
53
|
+
assert_equal('KLM', @r4)
|
54
|
+
assert_equal('n1o2p3@#$', @r5)
|
55
|
+
end
|
56
56
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
57
|
+
def test_return_value_custom_degree
|
58
|
+
assert_equal('def', @r6)
|
59
|
+
assert_equal('DEF', @r7)
|
60
|
+
assert_equal('uvw', @r8)
|
61
|
+
assert_equal('UVW', @r9)
|
62
|
+
end
|
63
63
|
|
64
|
-
|
65
|
-
|
66
|
-
|
64
|
+
def test_rotate_instance_method
|
65
|
+
assert_equal('abc', @r6.rotate(-3))
|
66
|
+
end
|
67
67
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
68
|
+
def teardown
|
69
|
+
@r1 = nil
|
70
|
+
@r2 = nil
|
71
|
+
@r3 = nil
|
72
|
+
@r4 = nil
|
73
|
+
@r5 = nil
|
74
|
+
@r6 = nil
|
75
|
+
@r7 = nil
|
76
|
+
@r8 = nil
|
77
|
+
@r9 = nil
|
78
|
+
end
|
79
79
|
end
|
data.tar.gz.sig
ADDED
Binary file
|
metadata
CHANGED
@@ -1,73 +1,84 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: crypt-rot13
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
- 5
|
10
|
-
version: 1.0.5
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.6
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Daniel J. Berger
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
|
-
cert_chain:
|
17
|
-
|
18
|
-
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDcDCCAligAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MREwDwYDVQQDDAhkamJl
|
14
|
+
cmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t
|
15
|
+
MB4XDTE1MDkwMjIwNDkxOFoXDTE2MDkwMTIwNDkxOFowPzERMA8GA1UEAwwIZGpi
|
16
|
+
ZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
|
17
|
+
bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMyTkvXqRp6hLs9eoJOS
|
18
|
+
Hmi8kRYbq9Vkf15/hMxJpotYMgJVHHWrmDcC5Dye2PbnXjTkKf266Zw0PtT9h+lI
|
19
|
+
S3ts9HO+vaCFSMwFFZmnWJSpQ3CNw2RcHxjWkk9yF7imEM8Kz9ojhiDXzBetdV6M
|
20
|
+
gr0lV/alUr7TNVBDngbXEfTWscyXh1qd7xZ4EcOdsDktCe5G45N/o3662tPQvJsi
|
21
|
+
FOF0CM/KuBsa/HL1/eoEmF4B3EKIRfTHrQ3hu20Kv3RJ88QM4ec2+0dd97uX693O
|
22
|
+
zv6981fyEg+aXLkxrkViM/tz2qR2ZE0jPhHTREPYeMEgptRkTmWSKAuLVWrJEfgl
|
23
|
+
DtkCAwEAAaN3MHUwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFEwe
|
24
|
+
nn6bfJADmuIDiMSOzedOrL+xMB0GA1UdEQQWMBSBEmRqYmVyZzk2QGdtYWlsLmNv
|
25
|
+
bTAdBgNVHRIEFjAUgRJkamJlcmc5NkBnbWFpbC5jb20wDQYJKoZIhvcNAQEFBQAD
|
26
|
+
ggEBAHmNOCWoDVD75zHFueY0viwGDVP1BNGFC+yXcb7u2GlK+nEMCORqzURbYPf7
|
27
|
+
tL+/hzmePIRz7i30UM//64GI1NLv9jl7nIwjhPpXpf7/lu2I9hOTsvwSumb5UiKC
|
28
|
+
/sqBxI3sfj9pr79Wpv4MuikX1XPik7Ncb7NPsJPw06Lvyc3Hkg5X2XpPtLtS+Gr2
|
29
|
+
wKJnmzb5rIPS1cmsqv0M9LPWflzfwoZ/SpnmhagP+g05p8bRNKjZSA2iImM/GyYZ
|
30
|
+
EJYzxdPOrx2n6NYR3Hk+vHP0U7UBSveI6+qx+ndQYaeyCn+GRX2PKS9h66YF/Q1V
|
31
|
+
tGSHgAmcLlkdGgan182qsE/4kKM=
|
32
|
+
-----END CERTIFICATE-----
|
33
|
+
date: 2016-01-16 00:00:00.000000000 Z
|
19
34
|
dependencies: []
|
20
|
-
|
21
|
-
|
35
|
+
description: |2
|
36
|
+
The crypt-rot13 library provides an interface for a simple character
|
37
|
+
substitution cipher known as ROT13, a variation on the Caesar cipher.
|
22
38
|
email: djberg96@gmail.com
|
23
39
|
executables: []
|
24
|
-
|
25
40
|
extensions: []
|
26
|
-
|
27
|
-
extra_rdoc_files:
|
41
|
+
extra_rdoc_files:
|
28
42
|
- README
|
29
43
|
- CHANGES
|
30
44
|
- MANIFEST
|
31
|
-
files:
|
45
|
+
files:
|
46
|
+
- certs
|
47
|
+
- certs/djberg96_pub.pem
|
32
48
|
- CHANGES
|
33
49
|
- crypt-rot13.gemspec
|
50
|
+
- lib
|
51
|
+
- lib/crypt
|
34
52
|
- lib/crypt/rot13.rb
|
53
|
+
- lib/crypt-rot13.rb
|
35
54
|
- MANIFEST
|
36
55
|
- Rakefile
|
37
56
|
- README
|
57
|
+
- test
|
38
58
|
- test/test_crypt_rot13.rb
|
39
|
-
homepage: http://
|
40
|
-
licenses:
|
59
|
+
homepage: http://github.com/djberg96/crypt-rot13
|
60
|
+
licenses:
|
41
61
|
- Artistic 2.0
|
62
|
+
metadata: {}
|
42
63
|
post_install_message:
|
43
64
|
rdoc_options: []
|
44
|
-
|
45
|
-
require_paths:
|
65
|
+
require_paths:
|
46
66
|
- lib
|
47
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
-
|
49
|
-
requirements:
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
50
69
|
- - ">="
|
51
|
-
- !ruby/object:Gem::Version
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
version: "0"
|
56
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
|
-
requirements:
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
59
74
|
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
|
62
|
-
segments:
|
63
|
-
- 0
|
64
|
-
version: "0"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
65
77
|
requirements: []
|
66
|
-
|
67
|
-
|
68
|
-
rubygems_version: 1.8.10
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 2.5.1
|
69
80
|
signing_key:
|
70
|
-
specification_version:
|
81
|
+
specification_version: 4
|
71
82
|
summary: Character rotation encryption, i.e. Caesar Cipher
|
72
|
-
test_files:
|
83
|
+
test_files:
|
73
84
|
- test/test_crypt_rot13.rb
|
metadata.gz.sig
ADDED
Binary file
|