bcrypt-ruby 2.0.3 → 2.0.4

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/CHANGELOG CHANGED
@@ -19,3 +19,7 @@
19
19
  - Made exception classes descend from StandardError, not Exception [Dan42]
20
20
  - Changed BCrypt::Engine.hash to BCrypt::Engine.hash_secret to avoid Merb
21
21
  sorting issues. [Lee Pope]
22
+
23
+ 2.0.4 Mar 09 2009
24
+ - Added Ruby 1.9 compatibility. [Genki Takiuchi]
25
+ - Fixed segfaults on some different types of empty strings. [Mike Pomraning]
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.3"
10
+ PKG_VERSION = "2.0.4"
11
11
  PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
12
12
  PKG_FILES = FileList[
13
13
  '[A-Z]*',
data/ext/bcrypt_ext.c CHANGED
@@ -10,13 +10,14 @@ VALUE cBCryptEngine;
10
10
  /* Given a logarithmic cost parameter, generates a salt for use with +bc_crypt+.
11
11
  */
12
12
  static VALUE bc_salt(VALUE self, VALUE cost, VALUE seed) {
13
- return rb_str_new2((char *)bcrypt_gensalt(NUM2INT(cost), (u_int8_t *)RSTRING(seed)->ptr));
13
+ return rb_str_new2((char *)bcrypt_gensalt(NUM2INT(cost), (u_int8_t *)RSTRING_PTR(seed)));
14
14
  }
15
15
 
16
16
  /* Given a secret and a salt, generates a salted hash (which you can then store safely).
17
17
  */
18
18
  static VALUE bc_crypt(VALUE self, VALUE key, VALUE salt) {
19
- return rb_str_new2((char *)bcrypt(RSTRING(key)->ptr, (char *)RSTRING(salt)->ptr));
19
+ const char * safeguarded = RSTRING_PTR(key) ? RSTRING_PTR(key) : "";
20
+ return rb_str_new2((char *)bcrypt(safeguarded, (char *)RSTRING_PTR(salt)));
20
21
  }
21
22
 
22
23
  /* Create the BCrypt and BCrypt::Internals modules, and populate them with methods. */
@@ -15,11 +15,17 @@ 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 behave normally if the secret not a string" do
18
+ specify "should behave normally if the secret is not a string" do
19
19
  lambda { BCrypt::Password.create(nil) }.should_not raise_error(BCrypt::Errors::InvalidSecret)
20
20
  lambda { BCrypt::Password.create({:woo => "yeah"}) }.should_not raise_error(BCrypt::Errors::InvalidSecret)
21
21
  lambda { BCrypt::Password.create(false) }.should_not raise_error(BCrypt::Errors::InvalidSecret)
22
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
23
29
  end
24
30
 
25
31
  context "Reading a hashed password" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bcrypt-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Coda Hale
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-05-07 00:00:00 -07:00
12
+ date: 2009-03-09 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -25,17 +25,17 @@ extra_rdoc_files:
25
25
  - CHANGELOG
26
26
  - lib/bcrypt.rb
27
27
  files:
28
- - Rakefile
28
+ - CHANGELOG
29
29
  - COPYING
30
+ - Rakefile
30
31
  - README
31
- - CHANGELOG
32
32
  - lib/bcrypt.rb
33
- - spec/spec_helper.rb
34
- - spec/bcrypt/password_spec.rb
35
33
  - spec/bcrypt/engine_spec.rb
36
- - ext/blowfish.c
34
+ - spec/bcrypt/password_spec.rb
35
+ - spec/spec_helper.rb
37
36
  - ext/bcrypt.c
38
37
  - ext/bcrypt_ext.c
38
+ - ext/blowfish.c
39
39
  - ext/blf.h
40
40
  - ext/extconf.rb
41
41
  has_rdoc: true
@@ -65,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
65
65
  requirements: []
66
66
 
67
67
  rubyforge_project: bcrypt-ruby
68
- rubygems_version: 1.1.1
68
+ rubygems_version: 1.3.1
69
69
  signing_key:
70
70
  specification_version: 2
71
71
  summary: OpenBSD's bcrypt() password hashing algorithm.