pbkdf2-ruby 0.2.0 → 0.2.1
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.
- data/VERSION +1 -1
- data/lib/pbkdf2.rb +2 -2
- metadata +2 -4
- data/benchmark.rb +0 -33
- data/pbkdf2.gemspec +0 -52
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/lib/pbkdf2.rb
CHANGED
@@ -2,7 +2,7 @@ require 'openssl'
|
|
2
2
|
|
3
3
|
class PBKDF2
|
4
4
|
def initialize(opts={})
|
5
|
-
@hash_function = OpenSSL::Digest
|
5
|
+
@hash_function = OpenSSL::Digest.new("sha256")
|
6
6
|
|
7
7
|
# override with options
|
8
8
|
opts.each_key do |k|
|
@@ -91,7 +91,7 @@ class PBKDF2
|
|
91
91
|
# if it's a string, first strip off any leading 'hmacWith' (which is implied)
|
92
92
|
hash.gsub!(/^hmacWith/i,'')
|
93
93
|
# see if the OpenSSL lib understands it
|
94
|
-
hash = OpenSSL::Digest
|
94
|
+
hash = OpenSSL::Digest.new(hash)
|
95
95
|
when OpenSSL::Digest
|
96
96
|
when OpenSSL::Digest::Digest
|
97
97
|
# ok
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pbkdf2-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-03-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -59,9 +59,7 @@ files:
|
|
59
59
|
- README.markdown
|
60
60
|
- Rakefile
|
61
61
|
- VERSION
|
62
|
-
- benchmark.rb
|
63
62
|
- lib/pbkdf2.rb
|
64
|
-
- pbkdf2.gemspec
|
65
63
|
- spec/pbkdf2_spec.rb
|
66
64
|
- spec/rfc3962_spec.rb
|
67
65
|
- spec/spec.opts
|
data/benchmark.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'benchmark'
|
2
|
-
require 'lib/pbkdf2'
|
3
|
-
|
4
|
-
n = 100000
|
5
|
-
#
|
6
|
-
# from active-ldap
|
7
|
-
module Salt
|
8
|
-
CHARS = ['.', '/', '0'..'9', 'A'..'Z', 'a'..'z'].collect do |x|
|
9
|
-
x.to_a
|
10
|
-
end.flatten
|
11
|
-
module_function
|
12
|
-
def generate(length)
|
13
|
-
salt = ""
|
14
|
-
length.times {salt << CHARS[rand(CHARS.length)]}
|
15
|
-
salt
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def next_salt
|
20
|
-
Salt.generate(8)
|
21
|
-
end
|
22
|
-
Benchmark.bm do |x|
|
23
|
-
x.report do
|
24
|
-
1.upto(n) do
|
25
|
-
PBKDF2.new do |p|
|
26
|
-
p.password = "s33krit"
|
27
|
-
p.salt = next_salt
|
28
|
-
p.iterations = 1000
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
data/pbkdf2.gemspec
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = "pbkdf2"
|
8
|
-
s.version = "0.2.0"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Sam Quigley"]
|
12
|
-
s.date = "2013-10-23"
|
13
|
-
s.description = "This implementation conforms to RFC 2898, and has been tested using the test vectors in Appendix B of RFC 3962. Note, however, that while those specifications use HMAC-SHA-1, this implementation defaults to HMAC-SHA-256. (SHA-256 provides a longer bit length. In addition, NIST has stated that SHA-1 should be phased out due to concerns over recent cryptanalytic attacks.)"
|
14
|
-
s.email = "quigley@emerose.com"
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE.TXT",
|
17
|
-
"README.markdown"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
"LICENSE.TXT",
|
21
|
-
"README.markdown",
|
22
|
-
"Rakefile",
|
23
|
-
"VERSION",
|
24
|
-
"benchmark.rb",
|
25
|
-
"lib/pbkdf2.rb",
|
26
|
-
"pbkdf2.gemspec",
|
27
|
-
"spec/pbkdf2_spec.rb",
|
28
|
-
"spec/rfc3962_spec.rb",
|
29
|
-
"spec/spec.opts",
|
30
|
-
"spec/spec_helper.rb"
|
31
|
-
]
|
32
|
-
s.homepage = "http://github.com/emerose/pbkdf2-ruby"
|
33
|
-
s.require_paths = ["lib"]
|
34
|
-
s.rubygems_version = "1.8.23"
|
35
|
-
s.summary = "Password-Based Key Derivation Function 2 - PBKDF2"
|
36
|
-
|
37
|
-
if s.respond_to? :specification_version then
|
38
|
-
s.specification_version = 3
|
39
|
-
|
40
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
41
|
-
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
42
|
-
s.add_development_dependency(%q<rdoc>, [">= 2.4.2"])
|
43
|
-
else
|
44
|
-
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
45
|
-
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
|
46
|
-
end
|
47
|
-
else
|
48
|
-
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
49
|
-
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|