bcrypt-ruby 3.0.0-x86-mingw32 → 3.0.1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3 -0
- data/Gemfile.lock +1 -1
- data/bcrypt-ruby.gemspec +1 -1
- data/ext/mri/bcrypt_ext.c +2 -2
- data/ext/mri/wrapper.c +4 -1
- data/lib/bcrypt.rb +1 -0
- data/spec/bcrypt/password_spec.rb +6 -0
- metadata +4 -4
data/CHANGELOG
CHANGED
data/Gemfile.lock
CHANGED
data/bcrypt-ruby.gemspec
CHANGED
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
|
-
|
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
|
-
|
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 =
|
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:
|
4
|
+
hash: 5
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 3.0.
|
9
|
+
- 1
|
10
|
+
version: 3.0.1
|
11
11
|
platform: x86-mingw32
|
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-
|
18
|
+
date: 2011-09-12 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rake-compiler
|