public
Description: bcrypt-ruby is a Ruby binding for the OpenBSD bcrypt() password hashing algorithm, allowing you to easily store a secure hash of your users' passwords.
Homepage: http://bcrypt-ruby.rubyforge.org
Clone URL: git://github.com/codahale/bcrypt-ruby.git
Changed BCrypt::Engine.hash to BCrypt::Engine.hash_secret to avoid Merb 
sorting issues. Thanks to Lee Pope for
the patch, including specs!
codahale (author)
Wed May 07 17:26:16 -0700 2008
commit  1696fcde2d7720cd5da20e4c16a39e9455f7d16d
tree    7a6d3a9d5e16e82408cb7b46f2648d827cbea356
parent  17a8701b53ff97626f522f8ae1dcbabc3af61fcd
...
15
16
17
18
19
20
 
 
 
 
...
15
16
17
 
 
18
19
20
21
22
0
@@ -15,5 +15,7 @@
0
  - Fixed example code in the README [Winson]
0
  - Fixed Solaris compatibility [Jeremy LaTrasse, Twitter crew]
0
 
0
-SVN Blah
0
- - Made exception classes descend from StandardError, not Exception [Dan42]
0
\ No newline at end of file
0
+HEAD
0
+ - Made exception classes descend from StandardError, not Exception [Dan42]
0
+ - Changed BCrypt::Engine.hash to BCrypt::Engine.hash_secret to avoid Merb
0
+ sorting issues. [Lee Pope]
...
28
29
30
31
 
32
33
34
...
123
124
125
126
 
127
128
129
...
139
140
141
142
 
143
144
145
...
158
159
160
161
162
 
...
28
29
30
 
31
32
33
34
...
123
124
125
 
126
127
128
129
...
139
140
141
 
142
143
144
145
...
158
159
160
 
161
162
0
@@ -28,7 +28,7 @@ module BCrypt
0
     
0
     # Given a secret and a valid salt (see BCrypt::Engine.generate_salt) calculates
0
     # a bcrypt() password hash.
0
- def self.hash(secret, salt)
0
+ def self.hash_secret(secret, salt)
0
       if valid_secret?(secret)
0
         if valid_salt?(salt)
0
           __bc_crypt(secret.to_s, salt)
0
@@ -123,7 +123,7 @@ module BCrypt
0
       #
0
       # @password = BCrypt::Password.create("my secret", :cost => 13)
0
       def create(secret, options = { :cost => BCrypt::Engine::DEFAULT_COST })
0
- Password.new(BCrypt::Engine.hash(secret, BCrypt::Engine.generate_salt(options[:cost])))
0
+ Password.new(BCrypt::Engine.hash_secret(secret, BCrypt::Engine.generate_salt(options[:cost])))
0
       end
0
     end
0
     
0
@@ -139,7 +139,7 @@ module BCrypt
0
     
0
     # Compares a potential secret against the hash. Returns true if the secret is the original secret, false otherwise.
0
     def ==(secret)
0
- super(BCrypt::Engine.hash(secret, @salt))
0
+ super(BCrypt::Engine.hash_secret(secret, @salt))
0
     end
0
     alias_method :is_password?, :==
0
     
0
@@ -158,4 +158,4 @@ module BCrypt
0
       return v, c.to_i, h[0, 29], mash[-31, 31]
0
     end
0
   end
0
-end
0
\ No newline at end of file
0
+end
...
35
36
37
38
 
39
40
41
42
 
43
44
45
46
47
 
 
48
49
50
...
57
58
59
60
 
61
62
63
64
 
...
35
36
37
 
38
39
40
41
 
42
43
44
45
 
 
46
47
48
49
50
...
57
58
59
 
60
61
62
 
63
64
0
@@ -35,16 +35,16 @@ context "Generating BCrypt hashes" do
0
   end
0
   
0
   specify "should produce a string" do
0
- BCrypt::Engine.hash(@password, @salt).should be_an_instance_of(String)
0
+ BCrypt::Engine.hash_secret(@password, @salt).should be_an_instance_of(String)
0
   end
0
   
0
   specify "should raise an InvalidSalt error if the salt is invalid" do
0
- lambda { BCrypt::Engine.hash(@password, 'nino') }.should raise_error(BCrypt::Errors::InvalidSalt)
0
+ lambda { BCrypt::Engine.hash_secret(@password, 'nino') }.should raise_error(BCrypt::Errors::InvalidSalt)
0
   end
0
   
0
   specify "should raise an InvalidSecret error if the secret is invalid" do
0
- lambda { BCrypt::Engine.hash(nil, @salt) }.should_not raise_error(BCrypt::Errors::InvalidSecret)
0
- lambda { BCrypt::Engine.hash(false, @salt) }.should_not raise_error(BCrypt::Errors::InvalidSecret)
0
+ lambda { BCrypt::Engine.hash_secret(nil, @salt) }.should_not raise_error(BCrypt::Errors::InvalidSecret)
0
+ lambda { BCrypt::Engine.hash_secret(false, @salt) }.should_not raise_error(BCrypt::Errors::InvalidSecret)
0
   end
0
   
0
   specify "should be interoperable with other implementations" do
0
@@ -57,7 +57,7 @@ context "Generating BCrypt hashes" do
0
       ["0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", "$2a$05$abcdefghijklmnopqrstuu", "$2a$05$abcdefghijklmnopqrstuu5s2v8.iXieOjg/.AySBTTZIIVFJeBui"]
0
     ]
0
     for secret, salt, test_vector in test_vectors
0
- BCrypt::Engine.hash(secret, salt).should eql(test_vector)
0
+ BCrypt::Engine.hash_secret(secret, salt).should eql(test_vector)
0
     end
0
   end
0
-end
0
\ No newline at end of file
0
+end

Comments

    No one has commented yet.