bcrypt 3.1.14 → 3.1.16
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.
- checksums.yaml +4 -4
- data/.travis.yml +1 -2
- data/CHANGELOG +6 -0
- data/Rakefile +2 -0
- data/bcrypt.gemspec +1 -1
- data/ext/mri/bcrypt_ext.c +18 -70
- data/ext/mri/wrapper.c +1 -1
- data/lib/bcrypt/password.rb +1 -1
- data/spec/bcrypt/password_spec.rb +2 -2
- metadata +7 -8
- data/Gemfile.lock +0 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24a80205a939e463319b4dd986b58cd5a4d43e66e864818e0c7efa7767e25cdc
|
4
|
+
data.tar.gz: 964599e45299ac4964773f2ede8e6a20eab2511910fecac3512e284bfff09a1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87542a66be75234db706e7f2995d4bee03e0b19611bb9bfa19e21c923656d863dfa5fadee6829e779b726a4370351734f92315f29ef8facbe89b90c930202d19
|
7
|
+
data.tar.gz: 6d4cd84d8e2bda4067c3816a339503257662c6f0eafcaffc7ba4aa05dacb76d4cd3d39e6c6f51951caf7f5d2ea325a81dcce374982aa3fdf57624d534b3c2ae5
|
data/.travis.yml
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
language: ruby
|
2
2
|
before_install:
|
3
3
|
- "echo 'gem: --no-rdoc --no-ri' > ~/.gemrc"
|
4
|
-
- gem update --system 2.7.8
|
5
|
-
- gem install bundler -v 1.17.3
|
6
4
|
rvm:
|
7
5
|
- 2.0
|
8
6
|
- 2.1
|
@@ -11,6 +9,7 @@ rvm:
|
|
11
9
|
- 2.4
|
12
10
|
- 2.5
|
13
11
|
- 2.6
|
12
|
+
- 2.7
|
14
13
|
- ruby-head
|
15
14
|
- jruby-head
|
16
15
|
- rbx-3
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
3.1.16 Sep 3 2020
|
2
|
+
- Fix compilation on FreeBSD. [GH #234]
|
3
|
+
|
4
|
+
3.1.15 July 21 2020
|
5
|
+
- Remove GVL optimization. Apparently it breaks things [GH #230]
|
6
|
+
|
1
7
|
3.1.14 July 21 2020
|
2
8
|
- Start calibration from the minimum cost supported by the algorithm [GH #206 by @sergey-alekseev]
|
3
9
|
|
data/Rakefile
CHANGED
data/bcrypt.gemspec
CHANGED
data/ext/mri/bcrypt_ext.c
CHANGED
@@ -1,50 +1,20 @@
|
|
1
1
|
#include <ruby.h>
|
2
2
|
#include <ow-crypt.h>
|
3
3
|
|
4
|
-
#ifdef HAVE_RUBY_THREAD_H
|
5
|
-
#include <ruby/thread.h>
|
6
|
-
#endif
|
7
|
-
|
8
4
|
static VALUE mBCrypt;
|
9
5
|
static VALUE cBCryptEngine;
|
10
6
|
|
11
|
-
struct bc_salt_args {
|
12
|
-
const char * prefix;
|
13
|
-
unsigned long count;
|
14
|
-
const char * input;
|
15
|
-
int size;
|
16
|
-
};
|
17
|
-
|
18
|
-
static void * bc_salt_nogvl(void * ptr) {
|
19
|
-
struct bc_salt_args * args = ptr;
|
20
|
-
|
21
|
-
return crypt_gensalt_ra(args->prefix, args->count, args->input, args->size);
|
22
|
-
}
|
23
|
-
|
24
7
|
/* Given a logarithmic cost parameter, generates a salt for use with +bc_crypt+.
|
25
8
|
*/
|
26
9
|
static VALUE bc_salt(VALUE self, VALUE prefix, VALUE count, VALUE input) {
|
27
10
|
char * salt;
|
28
11
|
VALUE str_salt;
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
prefix = rb_str_new_frozen(prefix);
|
36
|
-
input = rb_str_new_frozen(input);
|
37
|
-
|
38
|
-
args.prefix = StringValueCStr(prefix);
|
39
|
-
args.count = NUM2ULONG(count);
|
40
|
-
args.input = NIL_P(input) ? NULL : StringValuePtr(input);
|
41
|
-
args.size = NIL_P(input) ? 0 : RSTRING_LEN(input);
|
42
|
-
|
43
|
-
#ifdef HAVE_RUBY_THREAD_H
|
44
|
-
salt = rb_thread_call_without_gvl(bc_salt_nogvl, &args, NULL, NULL);
|
45
|
-
#else
|
46
|
-
salt = bc_salt_nogvl((void *)&args);
|
47
|
-
#endif
|
12
|
+
|
13
|
+
salt = crypt_gensalt_ra(
|
14
|
+
StringValuePtr(prefix),
|
15
|
+
NUM2ULONG(count),
|
16
|
+
NIL_P(input) ? NULL : StringValuePtr(input),
|
17
|
+
NIL_P(input) ? 0 : RSTRING_LEN(input));
|
48
18
|
|
49
19
|
if(!salt) return Qnil;
|
50
20
|
|
@@ -54,52 +24,30 @@ static VALUE bc_salt(VALUE self, VALUE prefix, VALUE count, VALUE input) {
|
|
54
24
|
return str_salt;
|
55
25
|
}
|
56
26
|
|
57
|
-
struct bc_crypt_args {
|
58
|
-
const char * key;
|
59
|
-
const char * setting;
|
60
|
-
void * data;
|
61
|
-
int size;
|
62
|
-
};
|
63
|
-
|
64
|
-
static void * bc_crypt_nogvl(void * ptr) {
|
65
|
-
struct bc_crypt_args * args = ptr;
|
66
|
-
|
67
|
-
return crypt_ra(args->key, args->setting, &args->data, &args->size);
|
68
|
-
}
|
69
|
-
|
70
27
|
/* Given a secret and a salt, generates a salted hash (which you can then store safely).
|
71
28
|
*/
|
72
29
|
static VALUE bc_crypt(VALUE self, VALUE key, VALUE setting) {
|
73
30
|
char * value;
|
31
|
+
void * data;
|
32
|
+
int size;
|
74
33
|
VALUE out;
|
75
34
|
|
76
|
-
|
35
|
+
data = NULL;
|
36
|
+
size = 0xDEADBEEF;
|
77
37
|
|
78
38
|
if(NIL_P(key) || NIL_P(setting)) return Qnil;
|
79
39
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
setting = rb_str_new_frozen(setting);
|
86
|
-
|
87
|
-
args.data = NULL;
|
88
|
-
args.size = 0xDEADBEEF;
|
89
|
-
args.key = NIL_P(key) ? NULL : StringValueCStr(key);
|
90
|
-
args.setting = NIL_P(setting) ? NULL : StringValueCStr(setting);
|
91
|
-
|
92
|
-
#ifdef HAVE_RUBY_THREAD_H
|
93
|
-
value = rb_thread_call_without_gvl(bc_crypt_nogvl, &args, NULL, NULL);
|
94
|
-
#else
|
95
|
-
value = bc_crypt_nogvl((void *)&args);
|
96
|
-
#endif
|
40
|
+
value = crypt_ra(
|
41
|
+
NIL_P(key) ? NULL : StringValuePtr(key),
|
42
|
+
NIL_P(setting) ? NULL : StringValuePtr(setting),
|
43
|
+
&data,
|
44
|
+
&size);
|
97
45
|
|
98
|
-
if(!value || !
|
46
|
+
if(!value || !data) return Qnil;
|
99
47
|
|
100
|
-
out =
|
48
|
+
out = rb_str_new2(value);
|
101
49
|
|
102
|
-
|
50
|
+
xfree(data);
|
103
51
|
|
104
52
|
return out;
|
105
53
|
}
|
data/ext/mri/wrapper.c
CHANGED
@@ -179,7 +179,7 @@ char *crypt_ra(const char *key, const char *setting,
|
|
179
179
|
return _crypt_blowfish_rn(key, setting, (char *)*data, *size);
|
180
180
|
}
|
181
181
|
|
182
|
-
char *crypt_r(const char *key, const char *setting,
|
182
|
+
char *crypt_r(const char *key, const char *setting, struct crypt_data *data)
|
183
183
|
{
|
184
184
|
return _crypt_retval_magic(
|
185
185
|
crypt_rn(key, setting, data, CRYPT_OUTPUT_SIZE),
|
data/lib/bcrypt/password.rb
CHANGED
@@ -116,9 +116,9 @@ end
|
|
116
116
|
|
117
117
|
describe "Validating a password hash" do
|
118
118
|
specify "should not accept an invalid password" do
|
119
|
-
expect(BCrypt::Password.valid_hash?("i_am_so_not_valid")).to
|
119
|
+
expect(BCrypt::Password.valid_hash?("i_am_so_not_valid")).to be(false)
|
120
120
|
end
|
121
121
|
specify "should accept a valid password" do
|
122
|
-
expect(BCrypt::Password.valid_hash?(BCrypt::Password.create "i_am_so_valid")).to
|
122
|
+
expect(BCrypt::Password.valid_hash?(BCrypt::Password.create "i_am_so_valid")).to be(true)
|
123
123
|
end
|
124
124
|
end
|
metadata
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bcrypt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Coda Hale
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: rake-compiler
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
16
15
|
requirements:
|
17
16
|
- - "~>"
|
18
17
|
- !ruby/object:Gem::Version
|
19
18
|
version: 0.9.2
|
19
|
+
name: rake-compiler
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -25,12 +25,12 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.9.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: rspec
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
30
29
|
requirements:
|
31
30
|
- - ">="
|
32
31
|
- !ruby/object:Gem::Version
|
33
32
|
version: '3'
|
33
|
+
name: rspec
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -50,10 +50,10 @@ extra_rdoc_files:
|
|
50
50
|
- README.md
|
51
51
|
- COPYING
|
52
52
|
- CHANGELOG
|
53
|
+
- lib/bcrypt.rb
|
54
|
+
- lib/bcrypt/password.rb
|
53
55
|
- lib/bcrypt/engine.rb
|
54
56
|
- lib/bcrypt/error.rb
|
55
|
-
- lib/bcrypt/password.rb
|
56
|
-
- lib/bcrypt.rb
|
57
57
|
files:
|
58
58
|
- ".gitignore"
|
59
59
|
- ".rspec"
|
@@ -61,7 +61,6 @@ files:
|
|
61
61
|
- CHANGELOG
|
62
62
|
- COPYING
|
63
63
|
- Gemfile
|
64
|
-
- Gemfile.lock
|
65
64
|
- README.md
|
66
65
|
- Rakefile
|
67
66
|
- appveyor.yml
|
@@ -112,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
111
|
- !ruby/object:Gem::Version
|
113
112
|
version: '0'
|
114
113
|
requirements: []
|
115
|
-
rubygems_version: 3.
|
114
|
+
rubygems_version: 3.0.6
|
116
115
|
signing_key:
|
117
116
|
specification_version: 4
|
118
117
|
summary: OpenBSD's bcrypt() password hashing algorithm.
|
data/Gemfile.lock
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
bcrypt (3.1.14)
|
5
|
-
|
6
|
-
GEM
|
7
|
-
remote: https://rubygems.org/
|
8
|
-
specs:
|
9
|
-
diff-lcs (1.4.4)
|
10
|
-
rake (13.0.1)
|
11
|
-
rake-compiler (0.9.9)
|
12
|
-
rake
|
13
|
-
rspec (3.9.0)
|
14
|
-
rspec-core (~> 3.9.0)
|
15
|
-
rspec-expectations (~> 3.9.0)
|
16
|
-
rspec-mocks (~> 3.9.0)
|
17
|
-
rspec-core (3.9.2)
|
18
|
-
rspec-support (~> 3.9.3)
|
19
|
-
rspec-expectations (3.9.2)
|
20
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
21
|
-
rspec-support (~> 3.9.0)
|
22
|
-
rspec-mocks (3.9.1)
|
23
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
24
|
-
rspec-support (~> 3.9.0)
|
25
|
-
rspec-support (3.9.3)
|
26
|
-
|
27
|
-
PLATFORMS
|
28
|
-
ruby
|
29
|
-
|
30
|
-
DEPENDENCIES
|
31
|
-
bcrypt!
|
32
|
-
rake-compiler (~> 0.9.2)
|
33
|
-
rspec (>= 3)
|
34
|
-
|
35
|
-
BUNDLED WITH
|
36
|
-
2.2.0.dev
|