armor 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/armor.rb +3 -1
  3. data/tests/rfc3962_test.rb +2 -2
  4. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2d116e5cf49bf377e2dedebf1d2a1d38732d307a
4
- data.tar.gz: 403a41018b14c74e855b1e3ae0de45230e4157db
3
+ metadata.gz: 7831b8cb6ba014fe648465a82d36fad86da99da3
4
+ data.tar.gz: ae514ec2acfa30cba2c3327cd8900891ef787be2
5
5
  SHA512:
6
- metadata.gz: cb983fca676a1998fc38edc16e3ae640c99c9052b7d9d2e2212f79b3e3c11e0bf8eca78f7438242c956cb987c4b27c3802a5a9e43e77cb4255a71f64c9e272a2
7
- data.tar.gz: 3354c524a11f35d420eb5c23f06d08a5870007905ae4a1762268de53be43263e963ac306db21a2022c3114f02e0689724f2af5a068698ae8bb55951ee8a72c02
6
+ metadata.gz: 445e9caf283a7cee3ad19c0377dd7dd3f005d6f35fd2f81c2567d0f201a937b015ca35ea4271cef785186eb3e6c89904852896b8b9d809c84b6e010bc4e8e6e2
7
+ data.tar.gz: 6b7955fec0fd5aa7b3cdc78d346504b2eb9c7aabcbf0ca15d227392203f2ec8e5de901861e04a5bca2aeb22e674bf8a756a467e8b1070c05cc1d39d96197ec47
@@ -1,6 +1,8 @@
1
1
  require "openssl"
2
2
 
3
3
  module Armor
4
+ Digest = RUBY_VERSION >= "2.1.0" ? OpenSSL::Digest : OpenSSL::Digest::Digest
5
+
4
6
  # Syntactic sugar for the underlying mathematical definition of PBKDF2.
5
7
  #
6
8
  # This function does not allow passing in of a dkLen (in other words
@@ -17,7 +19,7 @@ module Armor
17
19
  iter = ENV["ARMOR_ITER"] || 5000
18
20
  hash = ENV["ARMOR_HASH"] || "sha512"
19
21
 
20
- digest = OpenSSL::Digest::Digest.new(hash)
22
+ digest = Digest.new(hash)
21
23
  length = digest.digest_length
22
24
 
23
25
  hex(pbkdf2(digest, password, salt, Integer(iter), length))
@@ -59,7 +59,7 @@ test "should match the third test case in appendix B of RFC 3962" do
59
59
  # 5c 08 eb 61 fd f7 1e 4e 4e c3 cf 6b a1 f5 51 2b
60
60
  # a7 e5 2d db c5 e5 14 2f 70 8a 31 e2 e6 2b 1e 13
61
61
 
62
- digest = OpenSSL::Digest::Digest.new("sha1")
62
+ digest = Armor::Digest.new("sha1")
63
63
 
64
64
  actual = Armor.pbkdf2(digest, "password", "ATHENA.MIT.EDUraeburn", 1200, 16)
65
65
 
@@ -69,7 +69,7 @@ test "should match the third test case in appendix B of RFC 3962" do
69
69
  expected = "5c 08 eb 61 fd f7 1e 4e 4e c3 cf 6b a1 f5 51 2b" +
70
70
  "a7 e5 2d db c5 e5 14 2f 70 8a 31 e2 e6 2b 1e 13"
71
71
 
72
- actual = Armor.pbkdf2(digest, "password", "ATHENA.MIT.EDUraeburn", 1200, 32)
72
+ actual = Armor.pbkdf2(digest, "password", "ATHENA.MIT.EDUraeburn", 1200, 32)
73
73
 
74
74
  assert_equal expected.tr(' ', ''), Armor.hex(actual)
75
75
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: armor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cyril David
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-15 00:00:00.000000000 Z
12
+ date: 2014-03-20 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A PBKDF2 pure ruby implementation.
15
15
  email:
@@ -23,8 +23,8 @@ files:
23
23
  - LICENSE
24
24
  - makefile
25
25
  - lib/armor.rb
26
- - tests/armor_test.rb
27
26
  - tests/rfc3962_test.rb
27
+ - tests/armor_test.rb
28
28
  - bin/armor
29
29
  homepage: http://github.com/cyx/armor
30
30
  licenses:
@@ -46,7 +46,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
46
46
  version: '0'
47
47
  requirements: []
48
48
  rubyforge_project:
49
- rubygems_version: 2.0.3
49
+ rubygems_version: 2.0.14
50
50
  signing_key:
51
51
  specification_version: 4
52
52
  summary: shield's partner in crime.