scrypt 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +1 -0
- data/Gemfile.lock +14 -12
- data/Rakefile +1 -1
- data/lib/scrypt/version.rb +1 -1
- data/scrypt.gemspec +4 -3
- data/spec/scrypt/engine_spec.rb +4 -4
- data/spec/scrypt/password_spec.rb +2 -1
- metadata +22 -6
- data/Rakefile.old +0 -104
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use --create 1.9.3@scrypt
|
data/Gemfile.lock
CHANGED
@@ -1,26 +1,28 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
scrypt (1.0.
|
4
|
+
scrypt (1.0.5)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: http://rubygems.org/
|
8
8
|
specs:
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
rspec-
|
14
|
-
rspec-
|
15
|
-
|
16
|
-
rspec-
|
17
|
-
|
18
|
-
|
9
|
+
awesome_print (1.0.2)
|
10
|
+
diff-lcs (1.1.3)
|
11
|
+
rake (0.9.2.2)
|
12
|
+
rspec (2.9.0)
|
13
|
+
rspec-core (~> 2.9.0)
|
14
|
+
rspec-expectations (~> 2.9.0)
|
15
|
+
rspec-mocks (~> 2.9.0)
|
16
|
+
rspec-core (2.9.0)
|
17
|
+
rspec-expectations (2.9.1)
|
18
|
+
diff-lcs (~> 1.1.3)
|
19
|
+
rspec-mocks (2.9.0)
|
19
20
|
|
20
21
|
PLATFORMS
|
21
22
|
ruby
|
22
23
|
|
23
24
|
DEPENDENCIES
|
24
|
-
|
25
|
+
awesome_print
|
26
|
+
rake (~> 0.9.2)
|
25
27
|
rspec
|
26
28
|
scrypt!
|
data/Rakefile
CHANGED
data/lib/scrypt/version.rb
CHANGED
data/scrypt.gemspec
CHANGED
@@ -11,13 +11,14 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.homepage = ""
|
12
12
|
s.summary = "scrypt password hashing algorithm."
|
13
13
|
s.description = <<-EOF
|
14
|
-
The scrypt key derivation function is designed to be far
|
15
|
-
more secure against hardware brute-force attacks than
|
14
|
+
The scrypt key derivation function is designed to be far
|
15
|
+
more secure against hardware brute-force attacks than
|
16
16
|
alternative functions such as PBKDF2 or bcrypt.
|
17
17
|
EOF
|
18
18
|
|
19
19
|
s.add_development_dependency "rspec"
|
20
|
-
s.add_development_dependency "rake"
|
20
|
+
s.add_development_dependency "rake", "~> 0.9.2"
|
21
|
+
s.add_development_dependency "awesome_print"
|
21
22
|
|
22
23
|
s.rubyforge_project = "scrypt"
|
23
24
|
|
data/spec/scrypt/engine_spec.rb
CHANGED
@@ -7,8 +7,8 @@ describe "The SCrypt engine" do
|
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
|
-
describe "Generating SCrypt salts" do
|
11
10
|
|
11
|
+
describe "Generating SCrypt salts" do
|
12
12
|
it "should produce strings" do
|
13
13
|
SCrypt::Engine.generate_salt.should be_an_instance_of(String)
|
14
14
|
end
|
@@ -16,17 +16,16 @@ describe "Generating SCrypt salts" do
|
|
16
16
|
it "should produce random data" do
|
17
17
|
SCrypt::Engine.generate_salt.should_not equal(SCrypt::Engine.generate_salt)
|
18
18
|
end
|
19
|
-
|
20
19
|
end
|
21
20
|
|
22
|
-
describe "Autodetecting of salt cost" do
|
23
21
|
|
22
|
+
describe "Autodetecting of salt cost" do
|
24
23
|
it "should work" do
|
25
24
|
SCrypt::Engine.autodetect_cost("2a$08$c3$randomjunkgoeshere").should == "2a$08$c3$"
|
26
25
|
end
|
27
|
-
|
28
26
|
end
|
29
27
|
|
28
|
+
|
30
29
|
describe "Generating SCrypt hashes" do
|
31
30
|
|
32
31
|
class MyInvalidSecret
|
@@ -56,3 +55,4 @@ describe "Generating SCrypt hashes" do
|
|
56
55
|
SCrypt::Engine.hash_secret(false, @salt).should == SCrypt::Engine.hash_secret("false", @salt)
|
57
56
|
end
|
58
57
|
end
|
58
|
+
|
@@ -9,7 +9,7 @@ describe "Creating a hashed password" do
|
|
9
9
|
@password.should be_an_instance_of(SCrypt::Password)
|
10
10
|
end
|
11
11
|
|
12
|
-
it "should return a valid
|
12
|
+
it "should return a valid password" do
|
13
13
|
lambda { SCrypt::Password.new(@password) }.should_not raise_error
|
14
14
|
end
|
15
15
|
|
@@ -60,3 +60,4 @@ describe "Comparing a hashed password with a secret" do
|
|
60
60
|
(@password == "@secret").should be(false)
|
61
61
|
end
|
62
62
|
end
|
63
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scrypt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -29,6 +29,22 @@ dependencies:
|
|
29
29
|
version: '0'
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: rake
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 0.9.2
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.9.2
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: awesome_print
|
32
48
|
requirement: !ruby/object:Gem::Requirement
|
33
49
|
none: false
|
34
50
|
requirements:
|
@@ -43,8 +59,8 @@ dependencies:
|
|
43
59
|
- - ! '>='
|
44
60
|
- !ruby/object:Gem::Version
|
45
61
|
version: '0'
|
46
|
-
description: ! " The scrypt key derivation function is designed to be far
|
47
|
-
secure against hardware brute-force attacks than
|
62
|
+
description: ! " The scrypt key derivation function is designed to be far\n more
|
63
|
+
secure against hardware brute-force attacks than\n alternative functions such
|
48
64
|
as PBKDF2 or bcrypt.\n"
|
49
65
|
email:
|
50
66
|
- pbhogan@gmail.com
|
@@ -55,13 +71,13 @@ extra_rdoc_files: []
|
|
55
71
|
files:
|
56
72
|
- .gitignore
|
57
73
|
- .rspec
|
74
|
+
- .rvmrc
|
58
75
|
- CHANGELOG
|
59
76
|
- COPYING
|
60
77
|
- Gemfile
|
61
78
|
- Gemfile.lock
|
62
79
|
- README.md
|
63
80
|
- Rakefile
|
64
|
-
- Rakefile.old
|
65
81
|
- autotest/discover.rb
|
66
82
|
- ext/mri/Makefile
|
67
83
|
- ext/mri/crypto_scrypt-ref.c
|
@@ -99,7 +115,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
99
115
|
version: '0'
|
100
116
|
segments:
|
101
117
|
- 0
|
102
|
-
hash:
|
118
|
+
hash: 2356724981074653609
|
103
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
120
|
none: false
|
105
121
|
requirements:
|
@@ -108,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
124
|
version: '0'
|
109
125
|
segments:
|
110
126
|
- 0
|
111
|
-
hash:
|
127
|
+
hash: 2356724981074653609
|
112
128
|
requirements: []
|
113
129
|
rubyforge_project: scrypt
|
114
130
|
rubygems_version: 1.8.21
|
data/Rakefile.old
DELETED
@@ -1,104 +0,0 @@
|
|
1
|
-
gem "rspec"
|
2
|
-
|
3
|
-
require "rake"
|
4
|
-
require 'rake/gempackagetask'
|
5
|
-
require 'rake/contrib/rubyforgepublisher'
|
6
|
-
require 'rake/clean'
|
7
|
-
require 'rake/rdoctask'
|
8
|
-
require "benchmark"
|
9
|
-
require "rspec/core/rake_task"
|
10
|
-
|
11
|
-
PKG_NAME = "scrypt-ruby"
|
12
|
-
PKG_VERSION = "2.1.2"
|
13
|
-
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
|
14
|
-
PKG_FILES = FileList[
|
15
|
-
'[A-Z]*',
|
16
|
-
'lib/**/*.rb',
|
17
|
-
'spec/**/*.rb',
|
18
|
-
'ext/mri/*.c',
|
19
|
-
'ext/mri/*.h',
|
20
|
-
'ext/mri/*.rb'
|
21
|
-
]
|
22
|
-
CLEAN.include(
|
23
|
-
"ext/mri/*.o",
|
24
|
-
"ext/mri/*.bundle",
|
25
|
-
"ext/mri/*.so"
|
26
|
-
)
|
27
|
-
CLOBBER.include(
|
28
|
-
"ext/mri/Makefile",
|
29
|
-
"doc/coverage",
|
30
|
-
"pkg"
|
31
|
-
)
|
32
|
-
|
33
|
-
task :default => [:spec]
|
34
|
-
|
35
|
-
desc "Run all specs"
|
36
|
-
RSpec::Core::RakeTask.new do |t|
|
37
|
-
rspec_opts = ['--colour','--backtrace']
|
38
|
-
end
|
39
|
-
|
40
|
-
desc 'Generate RDoc'
|
41
|
-
rd = Rake::RDocTask.new do |rdoc|
|
42
|
-
rdoc.rdoc_dir = 'doc/rdoc'
|
43
|
-
rdoc.options << '--title' << 'scrypt-ruby' << '--line-numbers' << '--inline-source' << '--main' << 'README'
|
44
|
-
rdoc.template = ENV['TEMPLATE'] if ENV['TEMPLATE']
|
45
|
-
rdoc.rdoc_files.include('README', 'COPYING', 'CHANGELOG', 'lib/**/*.rb')
|
46
|
-
end
|
47
|
-
|
48
|
-
spec = Gem::Specification.new do |s|
|
49
|
-
s.name = PKG_NAME
|
50
|
-
s.version = PKG_VERSION
|
51
|
-
s.summary = "scrypt password hashing algorithm."
|
52
|
-
s.description = <<-EOF
|
53
|
-
The scrypt key derivation function was originally developed for
|
54
|
-
use in the Tarsnap online backup system and is designed to be far
|
55
|
-
more secure against hardware brute-force attacks than
|
56
|
-
alternative functions such as PBKDF2 or bcrypt.
|
57
|
-
EOF
|
58
|
-
|
59
|
-
s.files = PKG_FILES.to_a
|
60
|
-
s.require_path = 'lib'
|
61
|
-
|
62
|
-
s.has_rdoc = true
|
63
|
-
s.rdoc_options = rd.options
|
64
|
-
s.extra_rdoc_files = rd.rdoc_files.to_a
|
65
|
-
|
66
|
-
s.extensions = FileList["ext/mri/extconf.rb"].to_a
|
67
|
-
|
68
|
-
s.authors = ["Patrick Hogan"]
|
69
|
-
s.email = "pbhogan@gmail.com"
|
70
|
-
s.homepage = "http://scrypt-ruby.rubyforge.org"
|
71
|
-
end
|
72
|
-
|
73
|
-
Rake::GemPackageTask.new(spec) do |pkg|
|
74
|
-
pkg.need_zip = true
|
75
|
-
pkg.need_tar = true
|
76
|
-
end
|
77
|
-
|
78
|
-
desc "Clean, then compile the extension that's native to the current Ruby compiler."
|
79
|
-
task :compile => 'compile:mri'
|
80
|
-
|
81
|
-
namespace :compile do
|
82
|
-
desc "CLean, then compile all extensions"
|
83
|
-
task :all => [:mri]
|
84
|
-
|
85
|
-
desc "Clean, then compile the MRI extension"
|
86
|
-
task :mri => :clean do
|
87
|
-
Dir.chdir('ext/mri') do
|
88
|
-
ruby "extconf.rb"
|
89
|
-
sh "make"
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
desc "Run a set of benchmarks on the compiled extension."
|
95
|
-
task :benchmark do
|
96
|
-
TESTS = 100
|
97
|
-
TEST_PWD = "this is a test"
|
98
|
-
require File.expand_path(File.join(File.dirname(__FILE__), "lib", "scrypt"))
|
99
|
-
Benchmark.bmbm do |results|
|
100
|
-
4.upto(10) do |n|
|
101
|
-
results.report("cost #{n}:") { TESTS.times { scrypt::Password.create(TEST_PWD, :cost => n) } }
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|