bcrypt-ruby 3.0.0-x86-mswin32-60 → 3.0.1-x86-mswin32-60

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.
data/CHANGELOG CHANGED
@@ -42,3 +42,6 @@
42
42
  3.0.0 Aug 24, 2011
43
43
  - Bcrypt C implementation replaced with a public domain implementation.
44
44
  - License changed to MIT
45
+
46
+ 3.0.1
47
+ - create raises an exception if the cost is higher than 31. GH #27
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bcrypt-ruby (2.1.4)
4
+ bcrypt-ruby (3.0.0)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
data/bcrypt-ruby.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'bcrypt-ruby'
3
- s.version = '3.0.0'
3
+ s.version = '3.0.1'
4
4
 
5
5
  s.summary = "OpenBSD's bcrypt() password hashing algorithm."
6
6
  s.description = <<-EOF
data/ext/mri/bcrypt_ext.c CHANGED
@@ -44,7 +44,7 @@ static VALUE bc_salt(VALUE self, VALUE prefix, VALUE count, VALUE input) {
44
44
  if(!salt) return Qnil;
45
45
 
46
46
  str_salt = rb_str_new2(salt);
47
- free(salt);
47
+ xfree(salt);
48
48
 
49
49
  return str_salt;
50
50
  }
@@ -72,7 +72,7 @@ static VALUE bc_crypt(VALUE self, VALUE key, VALUE setting) {
72
72
 
73
73
  out = rb_str_new(data, size - 1);
74
74
 
75
- free(data);
75
+ xfree(data);
76
76
 
77
77
  return out;
78
78
  }
data/ext/mri/wrapper.c CHANGED
@@ -23,6 +23,9 @@
23
23
  #endif
24
24
  #endif
25
25
 
26
+ #include <ruby.h>
27
+ #include <util.h>
28
+
26
29
  #define CRYPT_OUTPUT_SIZE (7 + 22 + 31 + 1)
27
30
  #define CRYPT_GENSALT_OUTPUT_SIZE (7 + 22 + 1)
28
31
 
@@ -234,7 +237,7 @@ char *__crypt_gensalt_ra(__CONST char *prefix, unsigned long count,
234
237
  input, size, output, sizeof(output));
235
238
 
236
239
  if (retval) {
237
- retval = strdup(retval);
240
+ retval = ruby_strdup(retval);
238
241
  #ifndef __GLIBC__
239
242
  /* strdup(3) on glibc sets errno, so we don't need to bother */
240
243
  if (!retval)
data/lib/bcrypt.rb CHANGED
@@ -157,6 +157,7 @@ module BCrypt
157
157
  #
158
158
  # @password = BCrypt::Password.create("my secret", :cost => 13)
159
159
  def create(secret, options = { :cost => BCrypt::Engine::DEFAULT_COST })
160
+ raise ArgumentError if options[:cost] > 31
160
161
  Password.new(BCrypt::Engine.hash_secret(secret, BCrypt::Engine.generate_salt(options[:cost]), options[:cost]))
161
162
  end
162
163
  end
@@ -34,6 +34,12 @@ describe "Reading a hashed password" do
34
34
  @hash = "$2a$05$CCCCCCCCCCCCCCCCCCCCC.E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW"
35
35
  end
36
36
 
37
+ specify "the cost is too damn high" do
38
+ lambda {
39
+ BCrypt::Password.create("hello", :cost => 32)
40
+ }.should raise_error(ArgumentError)
41
+ end
42
+
37
43
  specify "should read the version, cost, salt, and hash" do
38
44
  password = BCrypt::Password.new(@hash)
39
45
  password.version.should eql("2a")
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bcrypt-ruby
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 0
9
- - 0
10
- version: 3.0.0
9
+ - 1
10
+ version: 3.0.1
11
11
  platform: x86-mswin32-60
12
12
  authors:
13
13
  - Coda Hale
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-24 00:00:00 Z
18
+ date: 2011-09-12 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rake-compiler