armor 0.0.2 → 0.0.3
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 +4 -4
- data/lib/armor.rb +3 -1
- data/tests/rfc3962_test.rb +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7831b8cb6ba014fe648465a82d36fad86da99da3
|
4
|
+
data.tar.gz: ae514ec2acfa30cba2c3327cd8900891ef787be2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 445e9caf283a7cee3ad19c0377dd7dd3f005d6f35fd2f81c2567d0f201a937b015ca35ea4271cef785186eb3e6c89904852896b8b9d809c84b6e010bc4e8e6e2
|
7
|
+
data.tar.gz: 6b7955fec0fd5aa7b3cdc78d346504b2eb9c7aabcbf0ca15d227392203f2ec8e5de901861e04a5bca2aeb22e674bf8a756a467e8b1070c05cc1d39d96197ec47
|
data/lib/armor.rb
CHANGED
@@ -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 =
|
22
|
+
digest = Digest.new(hash)
|
21
23
|
length = digest.digest_length
|
22
24
|
|
23
25
|
hex(pbkdf2(digest, password, salt, Integer(iter), length))
|
data/tests/rfc3962_test.rb
CHANGED
@@ -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 =
|
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.
|
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:
|
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.
|
49
|
+
rubygems_version: 2.0.14
|
50
50
|
signing_key:
|
51
51
|
specification_version: 4
|
52
52
|
summary: shield's partner in crime.
|