bcrypt-ruby 2.1.3-x86-mswin32-60 → 2.1.4-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'bcrypt-ruby'
3
- s.version = '2.1.3'
3
+ s.version = '2.1.4'
4
4
 
5
5
  s.summary = "OpenBSD's bcrypt() password hashing algorithm."
6
6
  s.description = <<-EOF
@@ -63,7 +63,7 @@ import java.security.SecureRandom;
63
63
  */
64
64
  public class BCrypt {
65
65
  // BCrypt parameters
66
- private static int GENSALT_DEFAULT_LOG2_ROUNDS = 10;
66
+ private static final int GENSALT_DEFAULT_LOG2_ROUNDS = 10;
67
67
  private static final int BCRYPT_SALT_LEN = 16;
68
68
 
69
69
  // Blowfish parameters
@@ -655,13 +655,14 @@ public class BCrypt {
655
655
 
656
656
  if (salt.charAt(0) != '$' || salt.charAt(1) != '2')
657
657
  throw new IllegalArgumentException ("Invalid salt version");
658
- if (salt.charAt(1) != '$') {
658
+ if (salt.charAt(2) == '$')
659
+ off = 3;
660
+ else {
659
661
  minor = salt.charAt(2);
660
662
  if (minor != 'a' || salt.charAt(3) != '$')
661
663
  throw new IllegalArgumentException ("Invalid salt revision");
662
664
  off = 4;
663
- } else
664
- off = 3;
665
+ }
665
666
 
666
667
  // Extract number of rounds
667
668
  if (salt.charAt(off + 2) > '$')
@@ -670,10 +671,9 @@ public class BCrypt {
670
671
 
671
672
  real_salt = salt.substring(off + 3, off + 25);
672
673
  try {
673
- passwordb = (password + (minor >= 'a' ? "\000" : "")).getBytes("US-ASCII");
674
+ passwordb = (password + (minor >= 'a' ? "\000" : "")).getBytes("UTF-8");
674
675
  } catch (UnsupportedEncodingException uee) {
675
- // The JDK guarantees that US-ASCII is supported.
676
- throw new AssertionError("US-ASCII is not supported");
676
+ throw new AssertionError("UTF-8 is not supported");
677
677
  }
678
678
 
679
679
  saltb = decode_base64(real_salt, BCRYPT_SALT_LEN);
@@ -172,4 +172,23 @@ public class TestBCrypt extends TestCase {
172
172
  }
173
173
  System.out.println("");
174
174
  }
175
+
176
+ /**
177
+ * Test for correct hashing of non-US-ASCII passwords
178
+ */
179
+ public void testInternationalChars() {
180
+ System.out.print("BCrypt.hashpw w/ international chars: ");
181
+ String pw1 = "ππππππππ";
182
+ String pw2 = "????????";
183
+
184
+ String h1 = BCrypt.hashpw(pw1, BCrypt.gensalt());
185
+ assertFalse(BCrypt.checkpw(pw2, h1));
186
+ System.out.print(".");
187
+
188
+ String h2 = BCrypt.hashpw(pw2, BCrypt.gensalt());
189
+ assertFalse(BCrypt.checkpw(pw1, h2));
190
+ System.out.print(".");
191
+ System.out.println("");
192
+ }
193
+
175
194
  }
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bcrypt-ruby
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: 3
5
+ prerelease:
5
6
  segments:
6
7
  - 2
7
8
  - 1
8
- - 3
9
- version: 2.1.3
9
+ - 4
10
+ version: 2.1.4
10
11
  platform: x86-mswin32-60
11
12
  authors:
12
13
  - Coda Hale
@@ -14,16 +15,18 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-12-20 00:00:00 -08:00
18
+ date: 2011-01-08 00:00:00 -08:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: rake-compiler
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 3
27
30
  segments:
28
31
  - 0
29
32
  version: "0"
@@ -33,9 +36,11 @@ dependencies:
33
36
  name: rspec
34
37
  prerelease: false
35
38
  requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
36
40
  requirements:
37
41
  - - ">="
38
42
  - !ruby/object:Gem::Version
43
+ hash: 3
39
44
  segments:
40
45
  - 0
41
46
  version: "0"
@@ -91,23 +96,27 @@ rdoc_options:
91
96
  require_paths:
92
97
  - lib
93
98
  required_ruby_version: !ruby/object:Gem::Requirement
99
+ none: false
94
100
  requirements:
95
101
  - - ">="
96
102
  - !ruby/object:Gem::Version
103
+ hash: 3
97
104
  segments:
98
105
  - 0
99
106
  version: "0"
100
107
  required_rubygems_version: !ruby/object:Gem::Requirement
108
+ none: false
101
109
  requirements:
102
110
  - - ">="
103
111
  - !ruby/object:Gem::Version
112
+ hash: 3
104
113
  segments:
105
114
  - 0
106
115
  version: "0"
107
116
  requirements: []
108
117
 
109
118
  rubyforge_project: bcrypt-ruby
110
- rubygems_version: 1.3.6
119
+ rubygems_version: 1.4.0
111
120
  signing_key:
112
121
  specification_version: 3
113
122
  summary: OpenBSD's bcrypt() password hashing algorithm.