crypt-rot13 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,8 @@
1
+ == 1.0.3 - 1-Aug-2009
2
+ * Changed license to Artistic 2.0.
3
+ * Some gemspec updates, including license update.
4
+ * Changed test file name to test_crypt_rot13.rb.
5
+
1
6
  == 1.0.2 - 25-Jul-2007
2
7
  * Changed Rot13Error to Rot13::Error
3
8
  * Added a Rakefile with tasks for installation and testing
data/MANIFEST CHANGED
@@ -4,4 +4,4 @@
4
4
  * Rakefile
5
5
  * crypt-rot13.gemspec
6
6
  * lib/crypt/rot13.rb
7
- * test/tc_rot13.rb
7
+ * test/test_crypt_rot13.rb
data/README CHANGED
@@ -1,6 +1,6 @@
1
1
  == Description
2
- A package for performing simple character rotation (i.e. Caesar Cipher)
3
- encryption. There are many like it, but this one is mine.
2
+ A library for performing simple character rotation (i.e. Caesar Cipher)
3
+ encryption. There are many like it, but this one is mine.
4
4
 
5
5
  == Installation
6
6
  === Manual Installation
@@ -21,6 +21,8 @@
21
21
  == Notes
22
22
  Not unicode friendly. Only works on ASCII values 65-90 and 97-122.
23
23
 
24
+ See http://en.wikipedia.org/wiki/ROT13 for more on ROT13
25
+
24
26
  == Acknowledgements
25
27
  Thanks go to Gaius Julius Caesar (d. 44 BC) for creating one of the first,
26
28
  and most simple, encryption schemes. Hail Caesar!
@@ -32,10 +34,10 @@
32
34
  http://www.rubyforge.org/projects/shards.
33
35
 
34
36
  == License
35
- Ruby's
37
+ Artistic 2.0
36
38
 
37
39
  == Copyright
38
- (C) 2005-2007, Daniel J. Berger, All Rights Reserved
40
+ (C) 2005-2009, Daniel J. Berger, All Rights Reserved
39
41
 
40
42
  == Warranty
41
43
  This package is provided "as is" and without any express or
@@ -44,5 +46,3 @@
44
46
 
45
47
  == Author
46
48
  Daniel J. Berger
47
- djberg96 at nospam at gmail dot com
48
- imperator on IRC (irc.freenode.net)
@@ -1,7 +1,7 @@
1
1
  ###############################################################
2
- # tc_rot13.rb
2
+ # test_crypt_rot13.rb
3
3
  #
4
- # Test suite for the crypt-rot13 package. You should run this
4
+ # Test suite for the crypt-rot13 library. You should run this
5
5
  # test case via the 'rake test' task.
6
6
  ###############################################################
7
7
  require 'crypt/rot13'
@@ -15,21 +15,21 @@ class TC_Rot13 < Test::Unit::TestCase
15
15
  @r3 = Rot13.new('xyz')
16
16
  @r4 = Rot13.new('XYZ')
17
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)
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
22
  end
23
23
 
24
24
  def test_version
25
- assert_equal('1.0.2', Rot13::VERSION)
25
+ assert_equal('1.0.3', Rot13::VERSION)
26
26
  end
27
27
 
28
28
  def test_constructor
29
29
  assert_respond_to(Rot13,:new)
30
30
  assert_nothing_raised{ Rot13.new }
31
- assert_nothing_raised{ Rot13.new("foo") }
32
- assert_nothing_raised{ Rot13.new("foo",7) }
31
+ assert_nothing_raised{ Rot13.new('foo') }
32
+ assert_nothing_raised{ Rot13.new('foo', 7) }
33
33
  end
34
34
 
35
35
  def test_available_methods
@@ -37,9 +37,9 @@ class TC_Rot13 < Test::Unit::TestCase
37
37
  end
38
38
 
39
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) }
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
43
  end
44
44
 
45
45
  def test_string_class
metadata CHANGED
@@ -1,53 +1,60 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.4
3
- specification_version: 1
4
2
  name: crypt-rot13
5
3
  version: !ruby/object:Gem::Version
6
- version: 1.0.2
7
- date: 2007-07-25 00:00:00 -06:00
8
- summary: Character rotation encryption, i.e. Caesar Cipher
9
- require_paths:
10
- - lib
11
- email: djberg96@gmail.com
12
- homepage: http://www.rubyforge.org/projects/shards
13
- rubyforge_project:
14
- description:
15
- autorequire:
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:
4
+ version: 1.0.3
25
5
  platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
29
6
  authors:
30
7
  - Daniel J. Berger
31
- files:
32
- - lib/crypt/rot13.rb
33
- - CHANGES
34
- - MANIFEST
35
- - README
36
- - Rakefile
37
- - test/tc_rot13.rb
38
- test_files:
39
- - test/tc_rot13.rb
40
- rdoc_options: []
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-08-01 00:00:00 -06:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: " The crypt-rot13 library provides an interface for a simple character\n substitution cipher known as ROT13, a variation on the Caesar cipher.\n"
17
+ email: djberg96@gmail.com
18
+ executables: []
19
+
20
+ extensions: []
41
21
 
42
22
  extra_rdoc_files:
43
23
  - README
44
24
  - CHANGES
45
25
  - MANIFEST
46
- executables: []
47
-
48
- extensions: []
26
+ files:
27
+ - test/test_crypt_rot13.rb
28
+ - README
29
+ - CHANGES
30
+ - MANIFEST
31
+ has_rdoc: true
32
+ homepage: http://www.rubyforge.org/projects/shards
33
+ licenses:
34
+ - Artistic 2.0
35
+ post_install_message:
36
+ rdoc_options: []
49
37
 
38
+ require_paths:
39
+ - lib
40
+ required_ruby_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: "0"
45
+ version:
46
+ required_rubygems_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: "0"
51
+ version:
50
52
  requirements: []
51
53
 
52
- dependencies: []
53
-
54
+ rubyforge_project: shards
55
+ rubygems_version: 1.3.5
56
+ signing_key:
57
+ specification_version: 3
58
+ summary: Character rotation encryption, i.e. Caesar Cipher
59
+ test_files:
60
+ - test/test_crypt_rot13.rb
data/Rakefile DELETED
@@ -1,22 +0,0 @@
1
- require 'rake'
2
- require 'rake/testtask'
3
-
4
- desc "Install the crypt-rot13 package (non-gem)"
5
- task :install do
6
- dest = File.join(Config::CONFIG['sitelibdir'], 'crypt')
7
- Dir.mkdir(dest) unless File.exists? dest
8
- cp 'lib/crypt/rot13.rb', dest, :verbose => true
9
- end
10
-
11
- desc "Install the crypt-rot13 package as a gem"
12
- task :install_gem do
13
- ruby 'crypt-rot13.gemspec'
14
- file = Dir["*.gem"].first
15
- sh "gem install #{file}"
16
- end
17
-
18
- Rake::TestTask.new do |t|
19
- t.libs << 'lib'
20
- t.warning = true
21
- t.test_files = FileList['test/tc*']
22
- end
data/lib/crypt/rot13.rb DELETED
@@ -1,48 +0,0 @@
1
- module Crypt
2
- class Rot13 < String
3
- class Error < ArgumentError; end
4
-
5
- VERSION = '1.0.2'
6
-
7
- # Returns a new Rot13 object. The object is a string with the letters
8
- # each rotated by +degree+.
9
- #
10
- # You cannot use a multiple of 26 as the degree or a Rot13::Error will
11
- # be raised. So, your days of double rot13 encryption are over.
12
- #
13
- def initialize(str='', degree=13)
14
- unless str.empty?
15
- str = rotate_string(str, degree)
16
- end
17
- super(str)
18
- end
19
-
20
- # Rotates the object by +degree+.
21
- #
22
- def rotate(degree)
23
- rotate_string(self, degree)
24
- end
25
-
26
- private
27
-
28
- def rotate_string(str,degree)
29
- case degree.modulo(26)
30
- when 0
31
- raise Error, "degree must not be a multiple of 26"
32
- when 13
33
- str.tr!("a-zA-Z","n-za-mN-ZA-M")
34
- else
35
- str = str.unpack("C"*str.length).map!{ |e|
36
- if e >= 97 && e <= 122
37
- e = ((e - 97 + degree) % 26) + 97
38
- elsif e >= 65 && e <= 90
39
- e = ((e - 65 + degree) % 26) + 65
40
- else
41
- e = e
42
- end
43
- }.pack("C"*str.length)
44
- end
45
- return str
46
- end
47
- end
48
- end