bcrypt 3.1.7 → 3.1.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -7
- data/CHANGELOG +99 -51
- data/README.md +66 -77
- data/ext/jruby/bcrypt_jruby/BCrypt.java +524 -351
- data/ext/mri/bcrypt_ext.c +76 -19
- data/ext/mri/crypt.h +12 -1
- data/ext/mri/crypt_blowfish.c +269 -152
- data/ext/mri/crypt_blowfish.h +27 -0
- data/ext/mri/crypt_gensalt.c +27 -14
- data/ext/mri/crypt_gensalt.h +30 -0
- data/ext/mri/extconf.rb +6 -1
- data/ext/mri/ow-crypt.h +25 -17
- data/ext/mri/wrapper.c +338 -46
- data/ext/mri/x86.S +203 -0
- data/lib/bcrypt/engine.rb +28 -10
- data/lib/bcrypt/password.rb +15 -5
- data/lib/bcrypt.rb +1 -6
- metadata +61 -72
- data/.gitignore +0 -10
- data/.rspec +0 -3
- data/.travis.yml +0 -15
- data/Gemfile +0 -2
- data/Gemfile.lock +0 -36
- data/Rakefile +0 -73
- data/bcrypt.gemspec +0 -29
- data/spec/TestBCrypt.java +0 -194
- data/spec/bcrypt/engine_spec.rb +0 -82
- data/spec/bcrypt/error_spec.rb +0 -37
- data/spec/bcrypt/password_spec.rb +0 -123
- data/spec/spec_helper.rb +0 -2
data/ext/mri/x86.S
ADDED
@@ -0,0 +1,203 @@
|
|
1
|
+
/*
|
2
|
+
* Written by Solar Designer <solar at openwall.com> in 1998-2010.
|
3
|
+
* No copyright is claimed, and the software is hereby placed in the public
|
4
|
+
* domain. In case this attempt to disclaim copyright and place the software
|
5
|
+
* in the public domain is deemed null and void, then the software is
|
6
|
+
* Copyright (c) 1998-2010 Solar Designer and it is hereby released to the
|
7
|
+
* general public under the following terms:
|
8
|
+
*
|
9
|
+
* Redistribution and use in source and binary forms, with or without
|
10
|
+
* modification, are permitted.
|
11
|
+
*
|
12
|
+
* There's ABSOLUTELY NO WARRANTY, express or implied.
|
13
|
+
*
|
14
|
+
* See crypt_blowfish.c for more information.
|
15
|
+
*/
|
16
|
+
|
17
|
+
#ifdef __i386__
|
18
|
+
|
19
|
+
#if defined(__OpenBSD__) && !defined(__ELF__)
|
20
|
+
#define UNDERSCORES
|
21
|
+
#define ALIGN_LOG
|
22
|
+
#endif
|
23
|
+
|
24
|
+
#if defined(__CYGWIN32__) || defined(__MINGW32__)
|
25
|
+
#define UNDERSCORES
|
26
|
+
#endif
|
27
|
+
|
28
|
+
#ifdef __DJGPP__
|
29
|
+
#define UNDERSCORES
|
30
|
+
#define ALIGN_LOG
|
31
|
+
#endif
|
32
|
+
|
33
|
+
#ifdef UNDERSCORES
|
34
|
+
#define _BF_body_r __BF_body_r
|
35
|
+
#endif
|
36
|
+
|
37
|
+
#ifdef ALIGN_LOG
|
38
|
+
#define DO_ALIGN(log) .align (log)
|
39
|
+
#elif defined(DUMBAS)
|
40
|
+
#define DO_ALIGN(log) .align 1 << log
|
41
|
+
#else
|
42
|
+
#define DO_ALIGN(log) .align (1 << (log))
|
43
|
+
#endif
|
44
|
+
|
45
|
+
#define BF_FRAME 0x200
|
46
|
+
#define ctx %esp
|
47
|
+
|
48
|
+
#define BF_ptr (ctx)
|
49
|
+
|
50
|
+
#define S(N, r) N+BF_FRAME(ctx,r,4)
|
51
|
+
#ifdef DUMBAS
|
52
|
+
#define P(N) 0x1000+N+N+N+N+BF_FRAME(ctx)
|
53
|
+
#else
|
54
|
+
#define P(N) 0x1000+4*N+BF_FRAME(ctx)
|
55
|
+
#endif
|
56
|
+
|
57
|
+
/*
|
58
|
+
* This version of the assembly code is optimized primarily for the original
|
59
|
+
* Intel Pentium but is also careful to avoid partial register stalls on the
|
60
|
+
* Pentium Pro family of processors (tested up to Pentium III Coppermine).
|
61
|
+
*
|
62
|
+
* It is possible to do 15% faster on the Pentium Pro family and probably on
|
63
|
+
* many non-Intel x86 processors, but, unfortunately, that would make things
|
64
|
+
* twice slower for the original Pentium.
|
65
|
+
*
|
66
|
+
* An additional 2% speedup may be achieved with non-reentrant code.
|
67
|
+
*/
|
68
|
+
|
69
|
+
#define L %esi
|
70
|
+
#define R %edi
|
71
|
+
#define tmp1 %eax
|
72
|
+
#define tmp1_lo %al
|
73
|
+
#define tmp2 %ecx
|
74
|
+
#define tmp2_hi %ch
|
75
|
+
#define tmp3 %edx
|
76
|
+
#define tmp3_lo %dl
|
77
|
+
#define tmp4 %ebx
|
78
|
+
#define tmp4_hi %bh
|
79
|
+
#define tmp5 %ebp
|
80
|
+
|
81
|
+
.text
|
82
|
+
|
83
|
+
#define BF_ROUND(L, R, N) \
|
84
|
+
xorl L,tmp2; \
|
85
|
+
xorl tmp1,tmp1; \
|
86
|
+
movl tmp2,L; \
|
87
|
+
shrl $16,tmp2; \
|
88
|
+
movl L,tmp4; \
|
89
|
+
movb tmp2_hi,tmp1_lo; \
|
90
|
+
andl $0xFF,tmp2; \
|
91
|
+
movb tmp4_hi,tmp3_lo; \
|
92
|
+
andl $0xFF,tmp4; \
|
93
|
+
movl S(0,tmp1),tmp1; \
|
94
|
+
movl S(0x400,tmp2),tmp5; \
|
95
|
+
addl tmp5,tmp1; \
|
96
|
+
movl S(0x800,tmp3),tmp5; \
|
97
|
+
xorl tmp5,tmp1; \
|
98
|
+
movl S(0xC00,tmp4),tmp5; \
|
99
|
+
addl tmp1,tmp5; \
|
100
|
+
movl 4+P(N),tmp2; \
|
101
|
+
xorl tmp5,R
|
102
|
+
|
103
|
+
#define BF_ENCRYPT_START \
|
104
|
+
BF_ROUND(L, R, 0); \
|
105
|
+
BF_ROUND(R, L, 1); \
|
106
|
+
BF_ROUND(L, R, 2); \
|
107
|
+
BF_ROUND(R, L, 3); \
|
108
|
+
BF_ROUND(L, R, 4); \
|
109
|
+
BF_ROUND(R, L, 5); \
|
110
|
+
BF_ROUND(L, R, 6); \
|
111
|
+
BF_ROUND(R, L, 7); \
|
112
|
+
BF_ROUND(L, R, 8); \
|
113
|
+
BF_ROUND(R, L, 9); \
|
114
|
+
BF_ROUND(L, R, 10); \
|
115
|
+
BF_ROUND(R, L, 11); \
|
116
|
+
BF_ROUND(L, R, 12); \
|
117
|
+
BF_ROUND(R, L, 13); \
|
118
|
+
BF_ROUND(L, R, 14); \
|
119
|
+
BF_ROUND(R, L, 15); \
|
120
|
+
movl BF_ptr,tmp5; \
|
121
|
+
xorl L,tmp2; \
|
122
|
+
movl P(17),L
|
123
|
+
|
124
|
+
#define BF_ENCRYPT_END \
|
125
|
+
xorl R,L; \
|
126
|
+
movl tmp2,R
|
127
|
+
|
128
|
+
DO_ALIGN(5)
|
129
|
+
.globl _BF_body_r
|
130
|
+
_BF_body_r:
|
131
|
+
movl 4(%esp),%eax
|
132
|
+
pushl %ebp
|
133
|
+
pushl %ebx
|
134
|
+
pushl %esi
|
135
|
+
pushl %edi
|
136
|
+
subl $BF_FRAME-8,%eax
|
137
|
+
xorl L,L
|
138
|
+
cmpl %esp,%eax
|
139
|
+
ja BF_die
|
140
|
+
xchgl %eax,%esp
|
141
|
+
xorl R,R
|
142
|
+
pushl %eax
|
143
|
+
leal 0x1000+BF_FRAME-4(ctx),%eax
|
144
|
+
movl 0x1000+BF_FRAME-4(ctx),tmp2
|
145
|
+
pushl %eax
|
146
|
+
xorl tmp3,tmp3
|
147
|
+
BF_loop_P:
|
148
|
+
BF_ENCRYPT_START
|
149
|
+
addl $8,tmp5
|
150
|
+
BF_ENCRYPT_END
|
151
|
+
leal 0x1000+18*4+BF_FRAME(ctx),tmp1
|
152
|
+
movl tmp5,BF_ptr
|
153
|
+
cmpl tmp5,tmp1
|
154
|
+
movl L,-8(tmp5)
|
155
|
+
movl R,-4(tmp5)
|
156
|
+
movl P(0),tmp2
|
157
|
+
ja BF_loop_P
|
158
|
+
leal BF_FRAME(ctx),tmp5
|
159
|
+
xorl tmp3,tmp3
|
160
|
+
movl tmp5,BF_ptr
|
161
|
+
BF_loop_S:
|
162
|
+
BF_ENCRYPT_START
|
163
|
+
BF_ENCRYPT_END
|
164
|
+
movl P(0),tmp2
|
165
|
+
movl L,(tmp5)
|
166
|
+
movl R,4(tmp5)
|
167
|
+
BF_ENCRYPT_START
|
168
|
+
BF_ENCRYPT_END
|
169
|
+
movl P(0),tmp2
|
170
|
+
movl L,8(tmp5)
|
171
|
+
movl R,12(tmp5)
|
172
|
+
BF_ENCRYPT_START
|
173
|
+
BF_ENCRYPT_END
|
174
|
+
movl P(0),tmp2
|
175
|
+
movl L,16(tmp5)
|
176
|
+
movl R,20(tmp5)
|
177
|
+
BF_ENCRYPT_START
|
178
|
+
addl $32,tmp5
|
179
|
+
BF_ENCRYPT_END
|
180
|
+
leal 0x1000+BF_FRAME(ctx),tmp1
|
181
|
+
movl tmp5,BF_ptr
|
182
|
+
cmpl tmp5,tmp1
|
183
|
+
movl P(0),tmp2
|
184
|
+
movl L,-8(tmp5)
|
185
|
+
movl R,-4(tmp5)
|
186
|
+
ja BF_loop_S
|
187
|
+
movl 4(%esp),%esp
|
188
|
+
popl %edi
|
189
|
+
popl %esi
|
190
|
+
popl %ebx
|
191
|
+
popl %ebp
|
192
|
+
ret
|
193
|
+
|
194
|
+
BF_die:
|
195
|
+
/* Oops, need to re-compile with a larger BF_FRAME. */
|
196
|
+
hlt
|
197
|
+
jmp BF_die
|
198
|
+
|
199
|
+
#endif
|
200
|
+
|
201
|
+
#if defined(__ELF__) && defined(__linux__)
|
202
|
+
.section .note.GNU-stack,"",%progbits
|
203
|
+
#endif
|
data/lib/bcrypt/engine.rb
CHANGED
@@ -2,9 +2,19 @@ module BCrypt
|
|
2
2
|
# A Ruby wrapper for the bcrypt() C extension calls and the Java calls.
|
3
3
|
class Engine
|
4
4
|
# The default computational expense parameter.
|
5
|
-
DEFAULT_COST =
|
5
|
+
DEFAULT_COST = 12
|
6
6
|
# The minimum cost supported by the algorithm.
|
7
7
|
MIN_COST = 4
|
8
|
+
# The maximum cost supported by the algorithm.
|
9
|
+
MAX_COST = 31
|
10
|
+
# Maximum possible size of bcrypt() secrets.
|
11
|
+
# Older versions of the bcrypt library would truncate passwords longer
|
12
|
+
# than 72 bytes, but newer ones do not. We truncate like the old library for
|
13
|
+
# forward compatibility. This way users upgrading from Ubuntu 18.04 to 20.04
|
14
|
+
# will not have their user passwords invalidated, for example.
|
15
|
+
# A max secret length greater than 255 leads to bcrypt returning nil.
|
16
|
+
# https://github.com/bcrypt-ruby/bcrypt-ruby/issues/225#issuecomment-875908425
|
17
|
+
MAX_SECRET_BYTESIZE = 72
|
8
18
|
# Maximum possible size of bcrypt() salts.
|
9
19
|
MAX_SALT_LENGTH = 16
|
10
20
|
|
@@ -28,8 +38,8 @@ module BCrypt
|
|
28
38
|
#
|
29
39
|
# Example:
|
30
40
|
#
|
31
|
-
# BCrypt::Engine::DEFAULT_COST #=>
|
32
|
-
# BCrypt::Password.create('secret').cost #=>
|
41
|
+
# BCrypt::Engine::DEFAULT_COST #=> 12
|
42
|
+
# BCrypt::Password.create('secret').cost #=> 12
|
33
43
|
#
|
34
44
|
# BCrypt::Engine.cost = 8
|
35
45
|
# BCrypt::Password.create('secret').cost #=> 8
|
@@ -41,14 +51,23 @@ module BCrypt
|
|
41
51
|
end
|
42
52
|
|
43
53
|
# Given a secret and a valid salt (see BCrypt::Engine.generate_salt) calculates
|
44
|
-
# a bcrypt() password hash.
|
54
|
+
# a bcrypt() password hash. Secrets longer than 72 bytes are truncated.
|
45
55
|
def self.hash_secret(secret, salt, _ = nil)
|
56
|
+
unless _.nil?
|
57
|
+
warn "[DEPRECATION] Passing the third argument to " \
|
58
|
+
"`BCrypt::Engine.hash_secret` is deprecated. " \
|
59
|
+
"Please do not pass the third argument which " \
|
60
|
+
"is currently not used."
|
61
|
+
end
|
62
|
+
|
46
63
|
if valid_secret?(secret)
|
47
64
|
if valid_salt?(salt)
|
48
65
|
if RUBY_PLATFORM == "java"
|
49
|
-
Java.bcrypt_jruby.BCrypt.hashpw(secret.to_s, salt.to_s)
|
66
|
+
Java.bcrypt_jruby.BCrypt.hashpw(secret.to_s.to_java_bytes, salt.to_s)
|
50
67
|
else
|
51
|
-
|
68
|
+
secret = secret.to_s
|
69
|
+
secret = secret.byteslice(0, MAX_SECRET_BYTESIZE) if secret && secret.bytesize > MAX_SECRET_BYTESIZE
|
70
|
+
__bc_crypt(secret, salt)
|
52
71
|
end
|
53
72
|
else
|
54
73
|
raise Errors::InvalidSalt.new("invalid salt")
|
@@ -68,8 +87,7 @@ module BCrypt
|
|
68
87
|
if RUBY_PLATFORM == "java"
|
69
88
|
Java.bcrypt_jruby.BCrypt.gensalt(cost)
|
70
89
|
else
|
71
|
-
|
72
|
-
__bc_salt(prefix, cost, OpenSSL::Random.random_bytes(MAX_SALT_LENGTH))
|
90
|
+
__bc_salt("$2a$", cost, OpenSSL::Random.random_bytes(MAX_SALT_LENGTH))
|
73
91
|
end
|
74
92
|
else
|
75
93
|
raise Errors::InvalidCost.new("cost must be numeric and > 0")
|
@@ -78,7 +96,7 @@ module BCrypt
|
|
78
96
|
|
79
97
|
# Returns true if +salt+ is a valid bcrypt() salt, false if not.
|
80
98
|
def self.valid_salt?(salt)
|
81
|
-
!!(salt =~
|
99
|
+
!!(salt =~ /\A\$[0-9a-z]{2,}\$[0-9]{2,}\$[A-Za-z0-9\.\/]{22,}\z/)
|
82
100
|
end
|
83
101
|
|
84
102
|
# Returns true if +secret+ is a valid bcrypt() secret, false if not.
|
@@ -99,7 +117,7 @@ module BCrypt
|
|
99
117
|
# # should take less than 1000ms
|
100
118
|
# BCrypt::Password.create("woo", :cost => 12)
|
101
119
|
def self.calibrate(upper_time_limit_in_ms)
|
102
|
-
|
120
|
+
(BCrypt::Engine::MIN_COST..BCrypt::Engine::MAX_COST-1).each do |i|
|
103
121
|
start_time = Time.now
|
104
122
|
Password.create("testing testing", :cost => i+1)
|
105
123
|
end_time = Time.now - start_time
|
data/lib/bcrypt/password.rb
CHANGED
@@ -7,7 +7,7 @@ module BCrypt
|
|
7
7
|
#
|
8
8
|
# # hash a user's password
|
9
9
|
# @password = Password.create("my grand secret")
|
10
|
-
# @password #=> "$2a$
|
10
|
+
# @password #=> "$2a$12$C5.FIvVDS9W4AYZ/Ib37YuWd/7ozp1UaMhU28UKrfSxp2oDchbi3K"
|
11
11
|
#
|
12
12
|
# # store it safely
|
13
13
|
# @user.update_attribute(:password, @password)
|
@@ -42,12 +42,12 @@ module BCrypt
|
|
42
42
|
# @password = BCrypt::Password.create("my secret", :cost => 13)
|
43
43
|
def create(secret, options = {})
|
44
44
|
cost = options[:cost] || BCrypt::Engine.cost
|
45
|
-
raise ArgumentError if cost >
|
45
|
+
raise ArgumentError if cost > BCrypt::Engine::MAX_COST
|
46
46
|
Password.new(BCrypt::Engine.hash_secret(secret, BCrypt::Engine.generate_salt(cost)))
|
47
47
|
end
|
48
48
|
|
49
49
|
def valid_hash?(h)
|
50
|
-
|
50
|
+
/\A\$[0-9a-z]{2}\$[0-9]{2}\$[A-Za-z0-9\.\/]{53}\z/ === h
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
@@ -62,6 +62,17 @@ module BCrypt
|
|
62
62
|
end
|
63
63
|
|
64
64
|
# Compares a potential secret against the hash. Returns true if the secret is the original secret, false otherwise.
|
65
|
+
#
|
66
|
+
# Comparison edge case/gotcha:
|
67
|
+
#
|
68
|
+
# secret = "my secret"
|
69
|
+
# @password = BCrypt::Password.create(secret)
|
70
|
+
#
|
71
|
+
# @password == secret # => True
|
72
|
+
# @password == @password # => False
|
73
|
+
# @password == @password.to_s # => False
|
74
|
+
# @password.to_s == @password # => True
|
75
|
+
# @password.to_s == @password.to_s # => True
|
65
76
|
def ==(secret)
|
66
77
|
super(BCrypt::Engine.hash_secret(secret, @salt))
|
67
78
|
end
|
@@ -80,8 +91,7 @@ module BCrypt
|
|
80
91
|
# Splits +h+ into version, cost, salt, and hash and returns them in that order.
|
81
92
|
def split_hash(h)
|
82
93
|
_, v, c, mash = h.split('$')
|
83
|
-
return v, c.to_i, h[0, 29].to_str, mash[-31, 31].to_str
|
94
|
+
return v.to_str, c.to_i, h[0, 29].to_str, mash[-31, 31].to_str
|
84
95
|
end
|
85
96
|
end
|
86
|
-
|
87
97
|
end
|
data/lib/bcrypt.rb
CHANGED
metadata
CHANGED
@@ -1,54 +1,52 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: bcrypt
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.1.20
|
5
5
|
platform: ruby
|
6
|
-
authors:
|
6
|
+
authors:
|
7
7
|
- Coda Hale
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2023-11-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
15
14
|
name: rake-compiler
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
version: 0.9.2
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.2.0
|
22
20
|
type: :development
|
23
|
-
version_requirements: *id001
|
24
|
-
- !ruby/object:Gem::Dependency
|
25
|
-
name: rspec
|
26
21
|
prerelease: false
|
27
|
-
|
28
|
-
requirements:
|
29
|
-
-
|
30
|
-
-
|
31
|
-
|
32
|
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.2.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3'
|
33
34
|
type: :development
|
34
|
-
version_requirements: *id002
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: rdoc
|
37
35
|
prerelease: false
|
38
|
-
|
39
|
-
requirements:
|
40
|
-
- -
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
version:
|
43
|
-
|
44
|
-
|
45
|
-
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3'
|
41
|
+
description: |2
|
42
|
+
bcrypt() is a sophisticated and secure hash algorithm designed by The OpenBSD project
|
43
|
+
for hashing passwords. The bcrypt Ruby gem provides a simple wrapper for safely handling
|
44
|
+
passwords.
|
46
45
|
email: coda.hale@gmail.com
|
47
46
|
executables: []
|
48
|
-
|
49
|
-
extensions:
|
47
|
+
extensions:
|
50
48
|
- ext/mri/extconf.rb
|
51
|
-
extra_rdoc_files:
|
49
|
+
extra_rdoc_files:
|
52
50
|
- README.md
|
53
51
|
- COPYING
|
54
52
|
- CHANGELOG
|
@@ -56,62 +54,53 @@ extra_rdoc_files:
|
|
56
54
|
- lib/bcrypt/error.rb
|
57
55
|
- lib/bcrypt/password.rb
|
58
56
|
- lib/bcrypt.rb
|
59
|
-
files:
|
60
|
-
- .gitignore
|
61
|
-
- .rspec
|
62
|
-
- .travis.yml
|
57
|
+
files:
|
63
58
|
- CHANGELOG
|
64
59
|
- COPYING
|
65
|
-
- Gemfile
|
66
|
-
- Gemfile.lock
|
67
60
|
- README.md
|
68
|
-
- Rakefile
|
69
|
-
- bcrypt.gemspec
|
70
61
|
- ext/jruby/bcrypt_jruby/BCrypt.java
|
71
62
|
- ext/mri/bcrypt_ext.c
|
72
63
|
- ext/mri/crypt.c
|
73
64
|
- ext/mri/crypt.h
|
74
65
|
- ext/mri/crypt_blowfish.c
|
66
|
+
- ext/mri/crypt_blowfish.h
|
75
67
|
- ext/mri/crypt_gensalt.c
|
68
|
+
- ext/mri/crypt_gensalt.h
|
76
69
|
- ext/mri/extconf.rb
|
77
70
|
- ext/mri/ow-crypt.h
|
78
71
|
- ext/mri/wrapper.c
|
72
|
+
- ext/mri/x86.S
|
79
73
|
- lib/bcrypt.rb
|
80
74
|
- lib/bcrypt/engine.rb
|
81
75
|
- lib/bcrypt/error.rb
|
82
76
|
- lib/bcrypt/password.rb
|
83
|
-
|
84
|
-
|
85
|
-
- spec/bcrypt/error_spec.rb
|
86
|
-
- spec/bcrypt/password_spec.rb
|
87
|
-
- spec/spec_helper.rb
|
88
|
-
homepage: https://github.com/codahale/bcrypt-ruby
|
89
|
-
licenses:
|
77
|
+
homepage: https://github.com/bcrypt-ruby/bcrypt-ruby
|
78
|
+
licenses:
|
90
79
|
- MIT
|
91
80
|
metadata: {}
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
- --title
|
81
|
+
post_install_message:
|
82
|
+
rdoc_options:
|
83
|
+
- "--title"
|
96
84
|
- bcrypt-ruby
|
97
|
-
- --line-numbers
|
98
|
-
- --inline-source
|
99
|
-
- --main
|
85
|
+
- "--line-numbers"
|
86
|
+
- "--inline-source"
|
87
|
+
- "--main"
|
100
88
|
- README.md
|
101
|
-
require_paths:
|
89
|
+
require_paths:
|
102
90
|
- lib
|
103
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
104
|
-
requirements:
|
105
|
-
-
|
106
|
-
|
107
|
-
|
108
|
-
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
109
101
|
requirements: []
|
110
|
-
|
111
|
-
|
112
|
-
rubygems_version: 2.0.14
|
113
|
-
signing_key:
|
102
|
+
rubygems_version: 3.4.10
|
103
|
+
signing_key:
|
114
104
|
specification_version: 4
|
115
105
|
summary: OpenBSD's bcrypt() password hashing algorithm.
|
116
106
|
test_files: []
|
117
|
-
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
bcrypt (3.1.7)
|
5
|
-
|
6
|
-
GEM
|
7
|
-
remote: https://rubygems.org/
|
8
|
-
specs:
|
9
|
-
diff-lcs (1.2.5)
|
10
|
-
json (1.8.1)
|
11
|
-
json (1.8.1-java)
|
12
|
-
rake (10.1.0)
|
13
|
-
rake-compiler (0.9.2)
|
14
|
-
rake
|
15
|
-
rdoc (3.12.2)
|
16
|
-
json (~> 1.4)
|
17
|
-
rspec (2.14.1)
|
18
|
-
rspec-core (~> 2.14.0)
|
19
|
-
rspec-expectations (~> 2.14.0)
|
20
|
-
rspec-mocks (~> 2.14.0)
|
21
|
-
rspec-core (2.14.7)
|
22
|
-
rspec-expectations (2.14.4)
|
23
|
-
diff-lcs (>= 1.1.3, < 2.0)
|
24
|
-
rspec-mocks (2.14.4)
|
25
|
-
|
26
|
-
PLATFORMS
|
27
|
-
java
|
28
|
-
ruby
|
29
|
-
x64-mingw32
|
30
|
-
x86-mingw32
|
31
|
-
|
32
|
-
DEPENDENCIES
|
33
|
-
bcrypt!
|
34
|
-
rake-compiler (~> 0.9.2)
|
35
|
-
rdoc (~> 3.12)
|
36
|
-
rspec
|
data/Rakefile
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
require 'rspec/core/rake_task'
|
2
|
-
require 'rubygems/package_task'
|
3
|
-
require 'rake/extensiontask'
|
4
|
-
require 'rake/javaextensiontask'
|
5
|
-
require 'rake/clean'
|
6
|
-
require 'rdoc/task'
|
7
|
-
require 'benchmark'
|
8
|
-
|
9
|
-
CLEAN.include(
|
10
|
-
"ext/mri/*.o",
|
11
|
-
"ext/mri/*.bundle",
|
12
|
-
"ext/mri/*.so",
|
13
|
-
"ext/jruby/bcrypt_jruby/*.class"
|
14
|
-
)
|
15
|
-
CLOBBER.include(
|
16
|
-
"ext/mri/Makefile",
|
17
|
-
"doc/coverage",
|
18
|
-
"pkg"
|
19
|
-
)
|
20
|
-
GEMSPEC = Gem::Specification.load("bcrypt.gemspec")
|
21
|
-
|
22
|
-
task :default => [:compile, :spec]
|
23
|
-
|
24
|
-
desc "Run all specs"
|
25
|
-
RSpec::Core::RakeTask.new do |t|
|
26
|
-
t.pattern = 'spec/**/*_spec.rb'
|
27
|
-
t.ruby_opts = '-w'
|
28
|
-
end
|
29
|
-
|
30
|
-
desc "Run all specs, with coverage testing"
|
31
|
-
RSpec::Core::RakeTask.new(:rcov) do |t|
|
32
|
-
t.pattern = 'spec/**/*_spec.rb'
|
33
|
-
t.rcov = true
|
34
|
-
t.rcov_path = 'doc/coverage'
|
35
|
-
t.rcov_opts = ['--exclude', 'rspec,diff-lcs,rcov,_spec,_helper']
|
36
|
-
end
|
37
|
-
|
38
|
-
desc 'Generate RDoc'
|
39
|
-
RDoc::Task.new do |rdoc|
|
40
|
-
rdoc.rdoc_dir = 'doc/rdoc'
|
41
|
-
rdoc.options += GEMSPEC.rdoc_options
|
42
|
-
rdoc.template = ENV['TEMPLATE'] if ENV['TEMPLATE']
|
43
|
-
rdoc.rdoc_files.include(*GEMSPEC.extra_rdoc_files)
|
44
|
-
end
|
45
|
-
|
46
|
-
Gem::PackageTask.new(GEMSPEC) do |pkg|
|
47
|
-
pkg.need_zip = true
|
48
|
-
pkg.need_tar = true
|
49
|
-
end
|
50
|
-
|
51
|
-
if RUBY_PLATFORM =~ /java/
|
52
|
-
Rake::JavaExtensionTask.new('bcrypt_ext', GEMSPEC) do |ext|
|
53
|
-
ext.ext_dir = 'ext/jruby'
|
54
|
-
end
|
55
|
-
else
|
56
|
-
Rake::ExtensionTask.new("bcrypt_ext", GEMSPEC) do |ext|
|
57
|
-
ext.ext_dir = 'ext/mri'
|
58
|
-
ext.cross_compile = true
|
59
|
-
ext.cross_platform = ['x86-mingw32', 'x64-mingw32']
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
desc "Run a set of benchmarks on the compiled extension."
|
64
|
-
task :benchmark do
|
65
|
-
TESTS = 100
|
66
|
-
TEST_PWD = "this is a test"
|
67
|
-
require File.expand_path(File.join(File.dirname(__FILE__), "lib", "bcrypt"))
|
68
|
-
Benchmark.bmbm do |results|
|
69
|
-
4.upto(10) do |n|
|
70
|
-
results.report("cost #{n}:") { TESTS.times { BCrypt::Password.create(TEST_PWD, :cost => n) } }
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|