bcrypt-ruby 2.1.3-x86-mingw32
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.
Potentially problematic release.
This version of bcrypt-ruby might be problematic. Click here for more details.
- data/.gitignore +7 -0
- data/.rspec +3 -0
- data/CHANGELOG +40 -0
- data/COPYING +33 -0
- data/Gemfile +2 -0
- data/README +175 -0
- data/Rakefile +89 -0
- data/bcrypt-ruby.gemspec +28 -0
- data/ext/jruby/bcrypt_jruby/BCrypt.java +752 -0
- data/ext/mri/bcrypt.c +297 -0
- data/ext/mri/bcrypt.h +67 -0
- data/ext/mri/bcrypt_ext.c +87 -0
- data/ext/mri/blf.h +86 -0
- data/ext/mri/blowfish.c +635 -0
- data/ext/mri/extconf.rb +17 -0
- data/lib/bcrypt.rb +190 -0
- data/lib/bcrypt_ext.rb +2 -0
- data/spec/TestBCrypt.java +175 -0
- data/spec/bcrypt/engine_spec.rb +82 -0
- data/spec/bcrypt/password_spec.rb +67 -0
- data/spec/spec_helper.rb +2 -0
- metadata +115 -0
@@ -0,0 +1,67 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "spec_helper"))
|
2
|
+
|
3
|
+
describe "Creating a hashed password" do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
@secret = "wheedle"
|
7
|
+
@password = BCrypt::Password.create(@secret, :cost => 4)
|
8
|
+
end
|
9
|
+
|
10
|
+
specify "should return a BCrypt::Password" do
|
11
|
+
@password.should be_an_instance_of(BCrypt::Password)
|
12
|
+
end
|
13
|
+
|
14
|
+
specify "should return a valid bcrypt password" do
|
15
|
+
lambda { BCrypt::Password.new(@password) }.should_not raise_error
|
16
|
+
end
|
17
|
+
|
18
|
+
specify "should behave normally if the secret is not a string" do
|
19
|
+
lambda { BCrypt::Password.create(nil) }.should_not raise_error(BCrypt::Errors::InvalidSecret)
|
20
|
+
lambda { BCrypt::Password.create({:woo => "yeah"}) }.should_not raise_error(BCrypt::Errors::InvalidSecret)
|
21
|
+
lambda { BCrypt::Password.create(false) }.should_not raise_error(BCrypt::Errors::InvalidSecret)
|
22
|
+
end
|
23
|
+
|
24
|
+
specify "should tolerate empty string secrets" do
|
25
|
+
lambda { BCrypt::Password.create( "\n".chop ) }.should_not raise_error
|
26
|
+
lambda { BCrypt::Password.create( "" ) }.should_not raise_error
|
27
|
+
lambda { BCrypt::Password.create( String.new ) }.should_not raise_error
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe "Reading a hashed password" do
|
32
|
+
before :each do
|
33
|
+
@secret = "U*U"
|
34
|
+
@hash = "$2a$05$CCCCCCCCCCCCCCCCCCCCC.E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW"
|
35
|
+
end
|
36
|
+
|
37
|
+
specify "should read the version, cost, salt, and hash" do
|
38
|
+
password = BCrypt::Password.new(@hash)
|
39
|
+
password.version.should eql("2a")
|
40
|
+
password.cost.should equal(5)
|
41
|
+
password.salt.should eql("$2a$05$CCCCCCCCCCCCCCCCCCCCC.")
|
42
|
+
password.salt.class.should == String
|
43
|
+
password.checksum.should eq("E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW")
|
44
|
+
password.checksum.class.should == String
|
45
|
+
password.to_s.should eql(@hash)
|
46
|
+
end
|
47
|
+
|
48
|
+
specify "should raise an InvalidHashError when given an invalid hash" do
|
49
|
+
lambda { BCrypt::Password.new('weedle') }.should raise_error(BCrypt::Errors::InvalidHash)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe "Comparing a hashed password with a secret" do
|
54
|
+
before :each do
|
55
|
+
@secret = "U*U"
|
56
|
+
@hash = "$2a$05$CCCCCCCCCCCCCCCCCCCCC.E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW"
|
57
|
+
@password = BCrypt::Password.create(@secret)
|
58
|
+
end
|
59
|
+
|
60
|
+
specify "should compare successfully to the original secret" do
|
61
|
+
(@password == @secret).should be(true)
|
62
|
+
end
|
63
|
+
|
64
|
+
specify "should compare unsuccessfully to anything besides original secret" do
|
65
|
+
(@password == "@secret").should be(false)
|
66
|
+
end
|
67
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bcrypt-ruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 2
|
7
|
+
- 1
|
8
|
+
- 3
|
9
|
+
version: 2.1.3
|
10
|
+
platform: x86-mingw32
|
11
|
+
authors:
|
12
|
+
- Coda Hale
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-12-20 00:00:00 -08:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: rake-compiler
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
version: "0"
|
30
|
+
type: :development
|
31
|
+
version_requirements: *id001
|
32
|
+
- !ruby/object:Gem::Dependency
|
33
|
+
name: rspec
|
34
|
+
prerelease: false
|
35
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
segments:
|
40
|
+
- 0
|
41
|
+
version: "0"
|
42
|
+
type: :development
|
43
|
+
version_requirements: *id002
|
44
|
+
description: " bcrypt() is a sophisticated and secure hash algorithm designed by The OpenBSD project\n for hashing passwords. bcrypt-ruby provides a simple, humane wrapper for safely handling\n passwords.\n"
|
45
|
+
email: coda.hale@gmail.com
|
46
|
+
executables: []
|
47
|
+
|
48
|
+
extensions: []
|
49
|
+
|
50
|
+
extra_rdoc_files:
|
51
|
+
- README
|
52
|
+
- COPYING
|
53
|
+
- CHANGELOG
|
54
|
+
- lib/bcrypt.rb
|
55
|
+
files:
|
56
|
+
- .gitignore
|
57
|
+
- .rspec
|
58
|
+
- CHANGELOG
|
59
|
+
- COPYING
|
60
|
+
- Gemfile
|
61
|
+
- README
|
62
|
+
- Rakefile
|
63
|
+
- bcrypt-ruby.gemspec
|
64
|
+
- ext/jruby/bcrypt_jruby/BCrypt.java
|
65
|
+
- ext/mri/bcrypt.c
|
66
|
+
- ext/mri/bcrypt.h
|
67
|
+
- ext/mri/bcrypt_ext.c
|
68
|
+
- ext/mri/blf.h
|
69
|
+
- ext/mri/blowfish.c
|
70
|
+
- ext/mri/extconf.rb
|
71
|
+
- lib/bcrypt.rb
|
72
|
+
- spec/TestBCrypt.java
|
73
|
+
- spec/bcrypt/engine_spec.rb
|
74
|
+
- spec/bcrypt/password_spec.rb
|
75
|
+
- spec/spec_helper.rb
|
76
|
+
- lib/1.8/bcrypt_ext.so
|
77
|
+
- lib/1.9/bcrypt_ext.so
|
78
|
+
- lib/bcrypt_ext.rb
|
79
|
+
has_rdoc: true
|
80
|
+
homepage: http://bcrypt-ruby.rubyforge.org
|
81
|
+
licenses: []
|
82
|
+
|
83
|
+
post_install_message:
|
84
|
+
rdoc_options:
|
85
|
+
- --title
|
86
|
+
- bcrypt-ruby
|
87
|
+
- --line-numbers
|
88
|
+
- --inline-source
|
89
|
+
- --main
|
90
|
+
- README
|
91
|
+
require_paths:
|
92
|
+
- lib
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
segments:
|
98
|
+
- 0
|
99
|
+
version: "0"
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
segments:
|
105
|
+
- 0
|
106
|
+
version: "0"
|
107
|
+
requirements: []
|
108
|
+
|
109
|
+
rubyforge_project: bcrypt-ruby
|
110
|
+
rubygems_version: 1.3.6
|
111
|
+
signing_key:
|
112
|
+
specification_version: 3
|
113
|
+
summary: OpenBSD's bcrypt() password hashing algorithm.
|
114
|
+
test_files: []
|
115
|
+
|