bcrypt-ruby 2.0.5 → 2.1.0
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 +7 -1
- data/COPYING +4 -3
- data/README +3 -0
- data/Rakefile +51 -25
- data/ext/jruby/bcrypt_jruby/BCrypt.class +0 -0
- data/ext/jruby/bcrypt_jruby/BCrypt.java +752 -0
- data/ext/{bcrypt.c → mri/bcrypt.c} +25 -31
- data/ext/mri/bcrypt.h +65 -0
- data/ext/mri/bcrypt_ext.c +87 -0
- data/ext/{blf.h → mri/blf.h} +0 -0
- data/ext/{blowfish.c → mri/blowfish.c} +0 -0
- data/ext/mri/extconf.rb +18 -0
- data/lib/bcrypt.rb +43 -13
- data/spec/bcrypt/engine_spec.rb +23 -4
- data/spec/bcrypt/password_spec.rb +4 -4
- data/spec/spec_helper.rb +1 -1
- metadata +16 -11
- data/ext/bcrypt_ext.c +0 -36
- data/ext/extconf.rb +0 -5
@@ -1,8 +1,8 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), "..", "spec_helper")
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "spec_helper"))
|
2
2
|
|
3
3
|
context "Creating a hashed password" do
|
4
4
|
|
5
|
-
|
5
|
+
before :each do
|
6
6
|
@secret = "wheedle"
|
7
7
|
@password = BCrypt::Password.create(@secret, :cost => 4)
|
8
8
|
end
|
@@ -29,7 +29,7 @@ context "Creating a hashed password" do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
context "Reading a hashed password" do
|
32
|
-
|
32
|
+
before :each do
|
33
33
|
@secret = "U*U"
|
34
34
|
@hash = "$2a$05$CCCCCCCCCCCCCCCCCCCCC.E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW"
|
35
35
|
end
|
@@ -48,7 +48,7 @@ context "Reading a hashed password" do
|
|
48
48
|
end
|
49
49
|
|
50
50
|
context "Comparing a hashed password with a secret" do
|
51
|
-
|
51
|
+
before :each do
|
52
52
|
@secret = "U*U"
|
53
53
|
@hash = "$2a$05$CCCCCCCCCCCCCCCCCCCCC.E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW"
|
54
54
|
@password = BCrypt::Password.create(@secret)
|
data/spec/spec_helper.rb
CHANGED
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
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Coda Hale
|
@@ -9,16 +9,16 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-08-13 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
16
|
-
description: bcrypt() is a sophisticated and secure hash algorithm designed by The OpenBSD project
|
16
|
+
description: " bcrypt() is a sophisticated and secure hash algorithm designed by The OpenBSD project\n for hashing passwords. bcrypt-ruby provides a simple, humane wrapper for safely handling\n passwords.\n"
|
17
17
|
email: coda.hale@gmail.com
|
18
18
|
executables: []
|
19
19
|
|
20
20
|
extensions:
|
21
|
-
- ext/extconf.rb
|
21
|
+
- ext/mri/extconf.rb
|
22
22
|
extra_rdoc_files:
|
23
23
|
- README
|
24
24
|
- COPYING
|
@@ -33,13 +33,18 @@ files:
|
|
33
33
|
- spec/bcrypt/engine_spec.rb
|
34
34
|
- spec/bcrypt/password_spec.rb
|
35
35
|
- spec/spec_helper.rb
|
36
|
-
- ext/bcrypt.c
|
37
|
-
- ext/bcrypt_ext.c
|
38
|
-
- ext/blowfish.c
|
39
|
-
- ext/
|
40
|
-
- ext/
|
36
|
+
- ext/mri/bcrypt.c
|
37
|
+
- ext/mri/bcrypt_ext.c
|
38
|
+
- ext/mri/blowfish.c
|
39
|
+
- ext/mri/bcrypt.h
|
40
|
+
- ext/mri/blf.h
|
41
|
+
- ext/mri/extconf.rb
|
42
|
+
- ext/jruby/bcrypt_jruby/BCrypt.java
|
43
|
+
- ext/jruby/bcrypt_jruby/BCrypt.class
|
41
44
|
has_rdoc: true
|
42
45
|
homepage: http://bcrypt-ruby.rubyforge.org
|
46
|
+
licenses: []
|
47
|
+
|
43
48
|
post_install_message:
|
44
49
|
rdoc_options:
|
45
50
|
- --title
|
@@ -65,9 +70,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
65
70
|
requirements: []
|
66
71
|
|
67
72
|
rubyforge_project: bcrypt-ruby
|
68
|
-
rubygems_version: 1.3.
|
73
|
+
rubygems_version: 1.3.5
|
69
74
|
signing_key:
|
70
|
-
specification_version:
|
75
|
+
specification_version: 3
|
71
76
|
summary: OpenBSD's bcrypt() password hashing algorithm.
|
72
77
|
test_files: []
|
73
78
|
|
data/ext/bcrypt_ext.c
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
#include "ruby.h"
|
2
|
-
#include "blf.h"
|
3
|
-
|
4
|
-
char *bcrypt_gensalt(u_int8_t, u_int8_t *);
|
5
|
-
char *bcrypt(const char *, const char *);
|
6
|
-
|
7
|
-
VALUE mBCrypt;
|
8
|
-
VALUE cBCryptEngine;
|
9
|
-
|
10
|
-
/* Define RSTRING_PTR for Ruby 1.8.5, ruby-core's idea of a point release is
|
11
|
-
insane. */
|
12
|
-
#ifndef RSTRING_PTR
|
13
|
-
# define RSTRING_PTR(s) (RSTRING(s)->ptr)
|
14
|
-
#endif
|
15
|
-
|
16
|
-
/* Given a logarithmic cost parameter, generates a salt for use with +bc_crypt+.
|
17
|
-
*/
|
18
|
-
static VALUE bc_salt(VALUE self, VALUE cost, VALUE seed) {
|
19
|
-
return rb_str_new2((char *)bcrypt_gensalt(NUM2INT(cost), (u_int8_t *)RSTRING_PTR(seed)));
|
20
|
-
}
|
21
|
-
|
22
|
-
/* Given a secret and a salt, generates a salted hash (which you can then store safely).
|
23
|
-
*/
|
24
|
-
static VALUE bc_crypt(VALUE self, VALUE key, VALUE salt) {
|
25
|
-
const char * safeguarded = RSTRING_PTR(key) ? RSTRING_PTR(key) : "";
|
26
|
-
return rb_str_new2((char *)bcrypt(safeguarded, (char *)RSTRING_PTR(salt)));
|
27
|
-
}
|
28
|
-
|
29
|
-
/* Create the BCrypt and BCrypt::Internals modules, and populate them with methods. */
|
30
|
-
void Init_bcrypt_ext(){
|
31
|
-
mBCrypt = rb_define_module("BCrypt");
|
32
|
-
cBCryptEngine = rb_define_class_under(mBCrypt, "Engine", rb_cObject);
|
33
|
-
|
34
|
-
rb_define_singleton_method(cBCryptEngine, "__bc_salt", bc_salt, 2);
|
35
|
-
rb_define_singleton_method(cBCryptEngine, "__bc_crypt", bc_crypt, 2);
|
36
|
-
}
|