bcrypt-ruby 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bcrypt-ruby might be problematic. Click here for more details.

data/CHANGELOG CHANGED
@@ -5,4 +5,8 @@
5
5
  - Removed BCrypt::Password#exactly_equals -- use BCrypt::Password#eql? instead.
6
6
  - Added BCrypt::Password#is_password?.
7
7
  - Refactored out BCrypt::Internals into more useful BCrypt::Engine.
8
- - Added validation of secrets -- nil is not healthy.
8
+ - Added validation of secrets -- nil is not healthy.
9
+
10
+ 2.0.1 Mar 09 2007
11
+ - Fixed load path issues
12
+ - Fixed crashes when hashing weird values (e.g., false, etc.)
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ require 'rake/rdoctask'
7
7
  require "benchmark"
8
8
 
9
9
  PKG_NAME = "bcrypt-ruby"
10
- PKG_VERSION = "2.0.0"
10
+ PKG_VERSION = "2.0.1"
11
11
  PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
12
12
  PKG_FILES = FileList[
13
13
  '[A-Z]*',
data/lib/bcrypt.rb CHANGED
@@ -1,12 +1,13 @@
1
1
  # A wrapper for OpenBSD's bcrypt/crypt_blowfish password-hashing algorithm.
2
2
 
3
- require "ext/bcrypt_ext"
3
+ $: << "ext"
4
+ require "bcrypt_ext"
4
5
  require "openssl"
5
6
 
6
7
  # A Ruby library implementing OpenBSD's bcrypt()/crypt_blowfish algorithm for
7
8
  # hashing passwords.
8
- module BCrypt
9
- module Errors # :nodoc:
9
+ module BCrypt
10
+ module Errors
10
11
  class InvalidSalt < Exception; end # The salt parameter provided to bcrypt() is invalid.
11
12
  class InvalidHash < Exception; end # The hash parameter provided to bcrypt() is invalid.
12
13
  class InvalidCost < Exception; end # The cost parameter provided to bcrypt() is invalid.
@@ -30,7 +31,7 @@ module BCrypt
30
31
  def self.hash(secret, salt)
31
32
  if valid_secret?(secret)
32
33
  if valid_salt?(salt)
33
- __bc_crypt(secret, salt)
34
+ __bc_crypt(secret.to_s, salt)
34
35
  else
35
36
  raise Errors::InvalidSalt.new("invalid salt")
36
37
  end
@@ -55,7 +56,7 @@ module BCrypt
55
56
 
56
57
  # Returns true if +secret+ is a valid bcrypt() secret, false if not.
57
58
  def self.valid_secret?(secret)
58
- !secret.nil?
59
+ secret.respond_to?(:to_s)
59
60
  end
60
61
 
61
62
  # Returns the cost factor which will result in computation times less than +upper_time_limit_in_ms+.
@@ -43,7 +43,8 @@ context "Generating BCrypt hashes" do
43
43
  end
44
44
 
45
45
  specify "should raise an InvalidSecret error if the secret is invalid" do
46
- lambda { BCrypt::Engine.hash(nil, @salt) }.should raise_error(BCrypt::Errors::InvalidSecret)
46
+ lambda { BCrypt::Engine.hash(nil, @salt) }.should_not raise_error(BCrypt::Errors::InvalidSecret)
47
+ lambda { BCrypt::Engine.hash(false, @salt) }.should_not raise_error(BCrypt::Errors::InvalidSecret)
47
48
  end
48
49
 
49
50
  specify "should be interoperable with other implementations" do
@@ -15,8 +15,10 @@ context "Creating a hashed password" do
15
15
  lambda { BCrypt::Password.new(@password) }.should_not raise_error
16
16
  end
17
17
 
18
- specify "should raise an InvalidSecret exception if the secret is nil" do
19
- lambda { BCrypt::Password.create(nil) }.should raise_error(BCrypt::Errors::InvalidSecret)
18
+ specify "should behave normally if the secret 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)
20
22
  end
21
23
  end
22
24
 
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.1
3
3
  specification_version: 1
4
4
  name: bcrypt-ruby
5
5
  version: !ruby/object:Gem::Version
6
- version: 2.0.0
7
- date: 2007-03-07 00:00:00 -08:00
6
+ version: 2.0.1
7
+ date: 2007-03-09 00:00:00 -08:00
8
8
  summary: OpenBSD's bcrypt() password hashing algorithm.
9
9
  require_paths:
10
10
  - lib