bcrypt 3.1.13 → 3.1.22
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/CHANGELOG +100 -67
- data/README.md +4 -6
- data/ext/jruby/bcrypt_jruby/BCrypt.java +4 -3
- data/ext/mri/bcrypt_ext.c +79 -18
- data/ext/mri/crypt_blowfish.c +6 -10
- data/ext/mri/crypt_gensalt.c +1 -1
- data/ext/mri/crypt_gensalt.h +1 -1
- data/ext/mri/wrapper.c +4 -1
- data/ext/mri/x86.S +1 -1
- data/lib/bcrypt/engine.rb +24 -6
- data/lib/bcrypt/password.rb +23 -4
- metadata +43 -31
- data/.gitignore +0 -9
- data/.rspec +0 -3
- data/.travis.yml +0 -17
- data/Gemfile +0 -2
- data/Gemfile.lock +0 -37
- data/Rakefile +0 -70
- data/appveyor.yml +0 -50
- data/bcrypt.gemspec +0 -27
- data/spec/TestBCrypt.java +0 -194
- data/spec/bcrypt/engine_spec.rb +0 -147
- data/spec/bcrypt/error_spec.rb +0 -37
- data/spec/bcrypt/password_spec.rb +0 -124
- data/spec/spec_helper.rb +0 -2
metadata
CHANGED
|
@@ -1,43 +1,70 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bcrypt
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.1.
|
|
4
|
+
version: 3.1.22
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Coda Hale
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: rake-compiler
|
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
|
15
15
|
requirements:
|
|
16
16
|
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version:
|
|
19
|
-
name: rake-compiler
|
|
20
|
-
prerelease: false
|
|
18
|
+
version: 1.2.0
|
|
21
19
|
type: :development
|
|
20
|
+
prerelease: false
|
|
22
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
22
|
requirements:
|
|
24
23
|
- - "~>"
|
|
25
24
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
25
|
+
version: 1.2.0
|
|
27
26
|
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: rspec
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
29
29
|
requirements:
|
|
30
30
|
- - ">="
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
32
|
version: '3'
|
|
33
|
-
name: rspec
|
|
34
|
-
prerelease: false
|
|
35
33
|
type: :development
|
|
34
|
+
prerelease: false
|
|
36
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
36
|
requirements:
|
|
38
37
|
- - ">="
|
|
39
38
|
- !ruby/object:Gem::Version
|
|
40
39
|
version: '3'
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: rdoc
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: 7.0.3
|
|
47
|
+
type: :development
|
|
48
|
+
prerelease: false
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: 7.0.3
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
name: benchmark
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: 0.5.0
|
|
61
|
+
type: :development
|
|
62
|
+
prerelease: false
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - ">="
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: 0.5.0
|
|
41
68
|
description: |2
|
|
42
69
|
bcrypt() is a sophisticated and secure hash algorithm designed by The OpenBSD project
|
|
43
70
|
for hashing passwords. The bcrypt Ruby gem provides a simple wrapper for safely handling
|
|
@@ -47,25 +74,17 @@ executables: []
|
|
|
47
74
|
extensions:
|
|
48
75
|
- ext/mri/extconf.rb
|
|
49
76
|
extra_rdoc_files:
|
|
50
|
-
- README.md
|
|
51
|
-
- COPYING
|
|
52
77
|
- CHANGELOG
|
|
78
|
+
- COPYING
|
|
79
|
+
- README.md
|
|
53
80
|
- lib/bcrypt.rb
|
|
54
|
-
- lib/bcrypt/password.rb
|
|
55
81
|
- lib/bcrypt/engine.rb
|
|
56
82
|
- lib/bcrypt/error.rb
|
|
83
|
+
- lib/bcrypt/password.rb
|
|
57
84
|
files:
|
|
58
|
-
- ".gitignore"
|
|
59
|
-
- ".rspec"
|
|
60
|
-
- ".travis.yml"
|
|
61
85
|
- CHANGELOG
|
|
62
86
|
- COPYING
|
|
63
|
-
- Gemfile
|
|
64
|
-
- Gemfile.lock
|
|
65
87
|
- README.md
|
|
66
|
-
- Rakefile
|
|
67
|
-
- appveyor.yml
|
|
68
|
-
- bcrypt.gemspec
|
|
69
88
|
- ext/jruby/bcrypt_jruby/BCrypt.java
|
|
70
89
|
- ext/mri/bcrypt_ext.c
|
|
71
90
|
- ext/mri/crypt.c
|
|
@@ -82,16 +101,11 @@ files:
|
|
|
82
101
|
- lib/bcrypt/engine.rb
|
|
83
102
|
- lib/bcrypt/error.rb
|
|
84
103
|
- lib/bcrypt/password.rb
|
|
85
|
-
|
|
86
|
-
- spec/bcrypt/engine_spec.rb
|
|
87
|
-
- spec/bcrypt/error_spec.rb
|
|
88
|
-
- spec/bcrypt/password_spec.rb
|
|
89
|
-
- spec/spec_helper.rb
|
|
90
|
-
homepage: https://github.com/codahale/bcrypt-ruby
|
|
104
|
+
homepage: https://github.com/bcrypt-ruby/bcrypt-ruby
|
|
91
105
|
licenses:
|
|
92
106
|
- MIT
|
|
93
|
-
metadata:
|
|
94
|
-
|
|
107
|
+
metadata:
|
|
108
|
+
changelog_uri: https://github.com/bcrypt-ruby/bcrypt-ruby/blob/master/CHANGELOG
|
|
95
109
|
rdoc_options:
|
|
96
110
|
- "--title"
|
|
97
111
|
- bcrypt-ruby
|
|
@@ -112,9 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
112
126
|
- !ruby/object:Gem::Version
|
|
113
127
|
version: '0'
|
|
114
128
|
requirements: []
|
|
115
|
-
|
|
116
|
-
rubygems_version: 2.7.6
|
|
117
|
-
signing_key:
|
|
129
|
+
rubygems_version: 4.0.6
|
|
118
130
|
specification_version: 4
|
|
119
131
|
summary: OpenBSD's bcrypt() password hashing algorithm.
|
|
120
132
|
test_files: []
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.travis.yml
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
language: ruby
|
|
2
|
-
before_install:
|
|
3
|
-
- "echo 'gem: --no-rdoc --no-ri' > ~/.gemrc"
|
|
4
|
-
- gem update --system 2.7.8
|
|
5
|
-
- gem install bundler -v 1.17.3
|
|
6
|
-
rvm:
|
|
7
|
-
- 2.0
|
|
8
|
-
- 2.1
|
|
9
|
-
- 2.2
|
|
10
|
-
- 2.3
|
|
11
|
-
- 2.4
|
|
12
|
-
- 2.5
|
|
13
|
-
- 2.6
|
|
14
|
-
- ruby-head
|
|
15
|
-
- jruby-head
|
|
16
|
-
- rbx-3
|
|
17
|
-
script: bundle exec rake
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
PATH
|
|
2
|
-
remote: .
|
|
3
|
-
specs:
|
|
4
|
-
bcrypt (3.1.13)
|
|
5
|
-
|
|
6
|
-
GEM
|
|
7
|
-
remote: https://rubygems.org/
|
|
8
|
-
specs:
|
|
9
|
-
diff-lcs (1.3)
|
|
10
|
-
rake (12.3.2)
|
|
11
|
-
rake-compiler (0.9.9)
|
|
12
|
-
rake
|
|
13
|
-
rspec (3.8.0)
|
|
14
|
-
rspec-core (~> 3.8.0)
|
|
15
|
-
rspec-expectations (~> 3.8.0)
|
|
16
|
-
rspec-mocks (~> 3.8.0)
|
|
17
|
-
rspec-core (3.8.0)
|
|
18
|
-
rspec-support (~> 3.8.0)
|
|
19
|
-
rspec-expectations (3.8.3)
|
|
20
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
21
|
-
rspec-support (~> 3.8.0)
|
|
22
|
-
rspec-mocks (3.8.0)
|
|
23
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
24
|
-
rspec-support (~> 3.8.0)
|
|
25
|
-
rspec-support (3.8.0)
|
|
26
|
-
|
|
27
|
-
PLATFORMS
|
|
28
|
-
java
|
|
29
|
-
ruby
|
|
30
|
-
|
|
31
|
-
DEPENDENCIES
|
|
32
|
-
bcrypt!
|
|
33
|
-
rake-compiler (~> 0.9.2)
|
|
34
|
-
rspec (>= 3)
|
|
35
|
-
|
|
36
|
-
BUNDLED WITH
|
|
37
|
-
1.16.1
|
data/Rakefile
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
require 'rspec/core/rake_task'
|
|
2
|
-
require 'rubygems/package_task'
|
|
3
|
-
require 'rake/extensiontask'
|
|
4
|
-
require 'rake/javaextensiontask'
|
|
5
|
-
require 'rake/clean'
|
|
6
|
-
require 'rdoc/task'
|
|
7
|
-
require 'benchmark'
|
|
8
|
-
|
|
9
|
-
CLEAN.include(
|
|
10
|
-
"tmp",
|
|
11
|
-
"lib/bcrypt_ext.jar",
|
|
12
|
-
"lib/bcrypt_ext.so"
|
|
13
|
-
)
|
|
14
|
-
CLOBBER.include(
|
|
15
|
-
"doc",
|
|
16
|
-
"pkg"
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
GEMSPEC = Gem::Specification.load("bcrypt.gemspec")
|
|
20
|
-
|
|
21
|
-
task :default => [:compile, :spec]
|
|
22
|
-
|
|
23
|
-
desc "Run all specs"
|
|
24
|
-
RSpec::Core::RakeTask.new do |t|
|
|
25
|
-
t.pattern = 'spec/**/*_spec.rb'
|
|
26
|
-
t.ruby_opts = '-w'
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
desc "Run all specs, with coverage testing"
|
|
30
|
-
RSpec::Core::RakeTask.new(:rcov) do |t|
|
|
31
|
-
t.pattern = 'spec/**/*_spec.rb'
|
|
32
|
-
t.rcov = true
|
|
33
|
-
t.rcov_path = 'doc/coverage'
|
|
34
|
-
t.rcov_opts = ['--exclude', 'rspec,diff-lcs,rcov,_spec,_helper']
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
desc 'Generate RDoc'
|
|
38
|
-
RDoc::Task.new do |rdoc|
|
|
39
|
-
rdoc.rdoc_dir = 'doc/rdoc'
|
|
40
|
-
rdoc.options += GEMSPEC.rdoc_options
|
|
41
|
-
rdoc.template = ENV['TEMPLATE'] if ENV['TEMPLATE']
|
|
42
|
-
rdoc.rdoc_files.include(*GEMSPEC.extra_rdoc_files)
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
Gem::PackageTask.new(GEMSPEC) do |pkg|
|
|
46
|
-
pkg.need_zip = true
|
|
47
|
-
pkg.need_tar = true
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
if RUBY_PLATFORM =~ /java/
|
|
51
|
-
Rake::JavaExtensionTask.new('bcrypt_ext', GEMSPEC) do |ext|
|
|
52
|
-
ext.ext_dir = 'ext/jruby'
|
|
53
|
-
end
|
|
54
|
-
else
|
|
55
|
-
Rake::ExtensionTask.new("bcrypt_ext", GEMSPEC) do |ext|
|
|
56
|
-
ext.ext_dir = 'ext/mri'
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
desc "Run a set of benchmarks on the compiled extension."
|
|
61
|
-
task :benchmark do
|
|
62
|
-
TESTS = 100
|
|
63
|
-
TEST_PWD = "this is a test"
|
|
64
|
-
require File.expand_path(File.join(File.dirname(__FILE__), "lib", "bcrypt"))
|
|
65
|
-
Benchmark.bmbm do |results|
|
|
66
|
-
4.upto(10) do |n|
|
|
67
|
-
results.report("cost #{n}:") { TESTS.times { BCrypt::Password.create(TEST_PWD, :cost => n) } }
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
|
-
end
|
data/appveyor.yml
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
version: "{branch}-{build}"
|
|
2
|
-
build: off
|
|
3
|
-
clone_depth: 1
|
|
4
|
-
|
|
5
|
-
init:
|
|
6
|
-
# Install Ruby head
|
|
7
|
-
- if %RUBY_VERSION%==head (
|
|
8
|
-
appveyor DownloadFile https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-head/rubyinstaller-head-x86.exe -FileName C:\head_x86.exe &
|
|
9
|
-
C:\head_x86.exe /verysilent /dir=C:\Ruby%RUBY_VERSION%
|
|
10
|
-
)
|
|
11
|
-
- if %RUBY_VERSION%==head-x64 (
|
|
12
|
-
appveyor DownloadFile https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-head/rubyinstaller-head-x64.exe -FileName C:\head_x64.exe &
|
|
13
|
-
C:\head_x64.exe /verysilent /dir=C:\Ruby%RUBY_VERSION%
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
# Add Ruby to the path
|
|
17
|
-
- set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
|
|
18
|
-
|
|
19
|
-
environment:
|
|
20
|
-
matrix:
|
|
21
|
-
- RUBY_VERSION: "head"
|
|
22
|
-
- RUBY_VERSION: "head-x64"
|
|
23
|
-
- RUBY_VERSION: "25"
|
|
24
|
-
- RUBY_VERSION: "25-x64"
|
|
25
|
-
- RUBY_VERSION: "24"
|
|
26
|
-
- RUBY_VERSION: "24-x64"
|
|
27
|
-
- RUBY_VERSION: "23"
|
|
28
|
-
- RUBY_VERSION: "23-x64"
|
|
29
|
-
- RUBY_VERSION: "22"
|
|
30
|
-
- RUBY_VERSION: "22-x64"
|
|
31
|
-
- RUBY_VERSION: "21"
|
|
32
|
-
- RUBY_VERSION: "21-x64"
|
|
33
|
-
- RUBY_VERSION: "200"
|
|
34
|
-
- RUBY_VERSION: "200-x64"
|
|
35
|
-
|
|
36
|
-
install:
|
|
37
|
-
- ps: "Set-Content -Value 'gem: --no-ri --no-rdoc ' -Path C:\\ProgramData\\gemrc"
|
|
38
|
-
- if %RUBY_VERSION%==head ( gem install bundler -v'< 2' )
|
|
39
|
-
- if %RUBY_VERSION%==head-x64 ( gem install bundler -v'< 2' )
|
|
40
|
-
- bundle install
|
|
41
|
-
|
|
42
|
-
before_build:
|
|
43
|
-
- ruby -v
|
|
44
|
-
- gem -v
|
|
45
|
-
|
|
46
|
-
build_script:
|
|
47
|
-
- bundle exec rake compile -rdevkit
|
|
48
|
-
|
|
49
|
-
test_script:
|
|
50
|
-
- bundle exec rake spec
|
data/bcrypt.gemspec
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
Gem::Specification.new do |s|
|
|
2
|
-
s.name = 'bcrypt'
|
|
3
|
-
s.version = '3.1.13'
|
|
4
|
-
|
|
5
|
-
s.summary = "OpenBSD's bcrypt() password hashing algorithm."
|
|
6
|
-
s.description = <<-EOF
|
|
7
|
-
bcrypt() is a sophisticated and secure hash algorithm designed by The OpenBSD project
|
|
8
|
-
for hashing passwords. The bcrypt Ruby gem provides a simple wrapper for safely handling
|
|
9
|
-
passwords.
|
|
10
|
-
EOF
|
|
11
|
-
|
|
12
|
-
s.files = `git ls-files`.split("\n")
|
|
13
|
-
s.require_path = 'lib'
|
|
14
|
-
|
|
15
|
-
s.add_development_dependency 'rake-compiler', '~> 0.9.2'
|
|
16
|
-
s.add_development_dependency 'rspec', '>= 3'
|
|
17
|
-
|
|
18
|
-
s.rdoc_options += ['--title', 'bcrypt-ruby', '--line-numbers', '--inline-source', '--main', 'README.md']
|
|
19
|
-
s.extra_rdoc_files += ['README.md', 'COPYING', 'CHANGELOG', *Dir['lib/**/*.rb']]
|
|
20
|
-
|
|
21
|
-
s.extensions = 'ext/mri/extconf.rb'
|
|
22
|
-
|
|
23
|
-
s.authors = ["Coda Hale"]
|
|
24
|
-
s.email = "coda.hale@gmail.com"
|
|
25
|
-
s.homepage = "https://github.com/codahale/bcrypt-ruby"
|
|
26
|
-
s.license = "MIT"
|
|
27
|
-
end
|
data/spec/TestBCrypt.java
DELETED
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2006 Damien Miller <djm@mindrot.org>
|
|
2
|
-
//
|
|
3
|
-
// Permission to use, copy, modify, and distribute this software for any
|
|
4
|
-
// purpose with or without fee is hereby granted, provided that the above
|
|
5
|
-
// copyright notice and this permission notice appear in all copies.
|
|
6
|
-
//
|
|
7
|
-
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
8
|
-
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
9
|
-
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
10
|
-
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
11
|
-
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
12
|
-
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
13
|
-
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
14
|
-
|
|
15
|
-
import junit.framework.TestCase;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* JUnit unit tests for BCrypt routines
|
|
19
|
-
* @author Damien Miller
|
|
20
|
-
* @version 0.2
|
|
21
|
-
*/
|
|
22
|
-
public class TestBCrypt extends TestCase {
|
|
23
|
-
String test_vectors[][] = {
|
|
24
|
-
{ "",
|
|
25
|
-
"$2a$06$DCq7YPn5Rq63x1Lad4cll.",
|
|
26
|
-
"$2a$06$DCq7YPn5Rq63x1Lad4cll.TV4S6ytwfsfvkgY8jIucDrjc8deX1s." },
|
|
27
|
-
{ "",
|
|
28
|
-
"$2a$08$HqWuK6/Ng6sg9gQzbLrgb.",
|
|
29
|
-
"$2a$08$HqWuK6/Ng6sg9gQzbLrgb.Tl.ZHfXLhvt/SgVyWhQqgqcZ7ZuUtye" },
|
|
30
|
-
{ "",
|
|
31
|
-
"$2a$10$k1wbIrmNyFAPwPVPSVa/ze",
|
|
32
|
-
"$2a$10$k1wbIrmNyFAPwPVPSVa/zecw2BCEnBwVS2GbrmgzxFUOqW9dk4TCW" },
|
|
33
|
-
{ "",
|
|
34
|
-
"$2a$12$k42ZFHFWqBp3vWli.nIn8u",
|
|
35
|
-
"$2a$12$k42ZFHFWqBp3vWli.nIn8uYyIkbvYRvodzbfbK18SSsY.CsIQPlxO" },
|
|
36
|
-
{ "a",
|
|
37
|
-
"$2a$06$m0CrhHm10qJ3lXRY.5zDGO",
|
|
38
|
-
"$2a$06$m0CrhHm10qJ3lXRY.5zDGO3rS2KdeeWLuGmsfGlMfOxih58VYVfxe" },
|
|
39
|
-
{ "a",
|
|
40
|
-
"$2a$08$cfcvVd2aQ8CMvoMpP2EBfe",
|
|
41
|
-
"$2a$08$cfcvVd2aQ8CMvoMpP2EBfeodLEkkFJ9umNEfPD18.hUF62qqlC/V." },
|
|
42
|
-
{ "a",
|
|
43
|
-
"$2a$10$k87L/MF28Q673VKh8/cPi.",
|
|
44
|
-
"$2a$10$k87L/MF28Q673VKh8/cPi.SUl7MU/rWuSiIDDFayrKk/1tBsSQu4u" },
|
|
45
|
-
{ "a",
|
|
46
|
-
"$2a$12$8NJH3LsPrANStV6XtBakCe",
|
|
47
|
-
"$2a$12$8NJH3LsPrANStV6XtBakCez0cKHXVxmvxIlcz785vxAIZrihHZpeS" },
|
|
48
|
-
{ "abc",
|
|
49
|
-
"$2a$06$If6bvum7DFjUnE9p2uDeDu",
|
|
50
|
-
"$2a$06$If6bvum7DFjUnE9p2uDeDu0YHzrHM6tf.iqN8.yx.jNN1ILEf7h0i" },
|
|
51
|
-
{ "abc",
|
|
52
|
-
"$2a$08$Ro0CUfOqk6cXEKf3dyaM7O",
|
|
53
|
-
"$2a$08$Ro0CUfOqk6cXEKf3dyaM7OhSCvnwM9s4wIX9JeLapehKK5YdLxKcm" },
|
|
54
|
-
{ "abc",
|
|
55
|
-
"$2a$10$WvvTPHKwdBJ3uk0Z37EMR.",
|
|
56
|
-
"$2a$10$WvvTPHKwdBJ3uk0Z37EMR.hLA2W6N9AEBhEgrAOljy2Ae5MtaSIUi" },
|
|
57
|
-
{ "abc",
|
|
58
|
-
"$2a$12$EXRkfkdmXn2gzds2SSitu.",
|
|
59
|
-
"$2a$12$EXRkfkdmXn2gzds2SSitu.MW9.gAVqa9eLS1//RYtYCmB1eLHg.9q" },
|
|
60
|
-
{ "abcdefghijklmnopqrstuvwxyz",
|
|
61
|
-
"$2a$06$.rCVZVOThsIa97pEDOxvGu",
|
|
62
|
-
"$2a$06$.rCVZVOThsIa97pEDOxvGuRRgzG64bvtJ0938xuqzv18d3ZpQhstC" },
|
|
63
|
-
{ "abcdefghijklmnopqrstuvwxyz",
|
|
64
|
-
"$2a$08$aTsUwsyowQuzRrDqFflhge",
|
|
65
|
-
"$2a$08$aTsUwsyowQuzRrDqFflhgekJ8d9/7Z3GV3UcgvzQW3J5zMyrTvlz." },
|
|
66
|
-
{ "abcdefghijklmnopqrstuvwxyz",
|
|
67
|
-
"$2a$10$fVH8e28OQRj9tqiDXs1e1u",
|
|
68
|
-
"$2a$10$fVH8e28OQRj9tqiDXs1e1uxpsjN0c7II7YPKXua2NAKYvM6iQk7dq" },
|
|
69
|
-
{ "abcdefghijklmnopqrstuvwxyz",
|
|
70
|
-
"$2a$12$D4G5f18o7aMMfwasBL7Gpu",
|
|
71
|
-
"$2a$12$D4G5f18o7aMMfwasBL7GpuQWuP3pkrZrOAnqP.bmezbMng.QwJ/pG" },
|
|
72
|
-
{ "~!@#$%^&*() ~!@#$%^&*()PNBFRD",
|
|
73
|
-
"$2a$06$fPIsBO8qRqkjj273rfaOI.",
|
|
74
|
-
"$2a$06$fPIsBO8qRqkjj273rfaOI.HtSV9jLDpTbZn782DC6/t7qT67P6FfO" },
|
|
75
|
-
{ "~!@#$%^&*() ~!@#$%^&*()PNBFRD",
|
|
76
|
-
"$2a$08$Eq2r4G/76Wv39MzSX262hu",
|
|
77
|
-
"$2a$08$Eq2r4G/76Wv39MzSX262huzPz612MZiYHVUJe/OcOql2jo4.9UxTW" },
|
|
78
|
-
{ "~!@#$%^&*() ~!@#$%^&*()PNBFRD",
|
|
79
|
-
"$2a$10$LgfYWkbzEvQ4JakH7rOvHe",
|
|
80
|
-
"$2a$10$LgfYWkbzEvQ4JakH7rOvHe0y8pHKF9OaFgwUZ2q7W2FFZmZzJYlfS" },
|
|
81
|
-
{ "~!@#$%^&*() ~!@#$%^&*()PNBFRD",
|
|
82
|
-
"$2a$12$WApznUOJfkEGSmYRfnkrPO",
|
|
83
|
-
"$2a$12$WApznUOJfkEGSmYRfnkrPOr466oFDCaj4b6HY3EXGvfxm43seyhgC" },
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Entry point for unit tests
|
|
88
|
-
* @param args unused
|
|
89
|
-
*/
|
|
90
|
-
public static void main(String[] args) {
|
|
91
|
-
junit.textui.TestRunner.run(TestBCrypt.class);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Test method for 'BCrypt.hashpw(String, String)'
|
|
96
|
-
*/
|
|
97
|
-
public void testHashpw() {
|
|
98
|
-
System.out.print("BCrypt.hashpw(): ");
|
|
99
|
-
for (int i = 0; i < test_vectors.length; i++) {
|
|
100
|
-
String plain = test_vectors[i][0];
|
|
101
|
-
String salt = test_vectors[i][1];
|
|
102
|
-
String expected = test_vectors[i][2];
|
|
103
|
-
String hashed = BCrypt.hashpw(plain, salt);
|
|
104
|
-
assertEquals(hashed, expected);
|
|
105
|
-
System.out.print(".");
|
|
106
|
-
}
|
|
107
|
-
System.out.println("");
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Test method for 'BCrypt.gensalt(int)'
|
|
112
|
-
*/
|
|
113
|
-
public void testGensaltInt() {
|
|
114
|
-
System.out.print("BCrypt.gensalt(log_rounds):");
|
|
115
|
-
for (int i = 4; i <= 12; i++) {
|
|
116
|
-
System.out.print(" " + Integer.toString(i) + ":");
|
|
117
|
-
for (int j = 0; j < test_vectors.length; j += 4) {
|
|
118
|
-
String plain = test_vectors[j][0];
|
|
119
|
-
String salt = BCrypt.gensalt(i);
|
|
120
|
-
String hashed1 = BCrypt.hashpw(plain, salt);
|
|
121
|
-
String hashed2 = BCrypt.hashpw(plain, hashed1);
|
|
122
|
-
assertEquals(hashed1, hashed2);
|
|
123
|
-
System.out.print(".");
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
System.out.println("");
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Test method for 'BCrypt.gensalt()'
|
|
131
|
-
*/
|
|
132
|
-
public void testGensalt() {
|
|
133
|
-
System.out.print("BCrypt.gensalt(): ");
|
|
134
|
-
for (int i = 0; i < test_vectors.length; i += 4) {
|
|
135
|
-
String plain = test_vectors[i][0];
|
|
136
|
-
String salt = BCrypt.gensalt();
|
|
137
|
-
String hashed1 = BCrypt.hashpw(plain, salt);
|
|
138
|
-
String hashed2 = BCrypt.hashpw(plain, hashed1);
|
|
139
|
-
assertEquals(hashed1, hashed2);
|
|
140
|
-
System.out.print(".");
|
|
141
|
-
}
|
|
142
|
-
System.out.println("");
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Test method for 'BCrypt.checkpw(String, String)'
|
|
147
|
-
* expecting success
|
|
148
|
-
*/
|
|
149
|
-
public void testCheckpw_success() {
|
|
150
|
-
System.out.print("BCrypt.checkpw w/ good passwords: ");
|
|
151
|
-
for (int i = 0; i < test_vectors.length; i++) {
|
|
152
|
-
String plain = test_vectors[i][0];
|
|
153
|
-
String expected = test_vectors[i][2];
|
|
154
|
-
assertTrue(BCrypt.checkpw(plain, expected));
|
|
155
|
-
System.out.print(".");
|
|
156
|
-
}
|
|
157
|
-
System.out.println("");
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Test method for 'BCrypt.checkpw(String, String)'
|
|
162
|
-
* expecting failure
|
|
163
|
-
*/
|
|
164
|
-
public void testCheckpw_failure() {
|
|
165
|
-
System.out.print("BCrypt.checkpw w/ bad passwords: ");
|
|
166
|
-
for (int i = 0; i < test_vectors.length; i++) {
|
|
167
|
-
int broken_index = (i + 4) % test_vectors.length;
|
|
168
|
-
String plain = test_vectors[i][0];
|
|
169
|
-
String expected = test_vectors[broken_index][2];
|
|
170
|
-
assertFalse(BCrypt.checkpw(plain, expected));
|
|
171
|
-
System.out.print(".");
|
|
172
|
-
}
|
|
173
|
-
System.out.println("");
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Test for correct hashing of non-US-ASCII passwords
|
|
178
|
-
*/
|
|
179
|
-
public void testInternationalChars() {
|
|
180
|
-
System.out.print("BCrypt.hashpw w/ international chars: ");
|
|
181
|
-
String pw1 = "ππππππππ";
|
|
182
|
-
String pw2 = "????????";
|
|
183
|
-
|
|
184
|
-
String h1 = BCrypt.hashpw(pw1, BCrypt.gensalt());
|
|
185
|
-
assertFalse(BCrypt.checkpw(pw2, h1));
|
|
186
|
-
System.out.print(".");
|
|
187
|
-
|
|
188
|
-
String h2 = BCrypt.hashpw(pw2, BCrypt.gensalt());
|
|
189
|
-
assertFalse(BCrypt.checkpw(pw1, h2));
|
|
190
|
-
System.out.print(".");
|
|
191
|
-
System.out.println("");
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
}
|