bcrypt-ruby 3.0.0-java → 3.0.1-java

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -42,3 +42,6 @@
42
42
  3.0.0 Aug 24, 2011
43
43
  - Bcrypt C implementation replaced with a public domain implementation.
44
44
  - License changed to MIT
45
+
46
+ 3.0.1
47
+ - create raises an exception if the cost is higher than 31. GH #27
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bcrypt-ruby (2.1.4)
4
+ bcrypt-ruby (3.0.0)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
data/bcrypt-ruby.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'bcrypt-ruby'
3
- s.version = '3.0.0'
3
+ s.version = '3.0.1'
4
4
 
5
5
  s.summary = "OpenBSD's bcrypt() password hashing algorithm."
6
6
  s.description = <<-EOF
@@ -9,8 +9,7 @@ Gem::Specification.new do |s|
9
9
  passwords.
10
10
  EOF
11
11
 
12
- s.platform = 'java'
13
- s.files = `git ls-files`.split("\n") + ['lib/bcrypt_ext.jar']
12
+ s.files = `git ls-files`.split("\n")
14
13
  s.require_path = 'lib'
15
14
 
16
15
  s.add_development_dependency 'rake-compiler'
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
- free(salt);
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
- free(data);
75
+ xfree(data);
76
76
 
77
77
  return out;
78
78
  }
data/ext/mri/wrapper.c CHANGED
@@ -23,6 +23,8 @@
23
23
  #endif
24
24
  #endif
25
25
 
26
+ #include <util.h>
27
+
26
28
  #define CRYPT_OUTPUT_SIZE (7 + 22 + 31 + 1)
27
29
  #define CRYPT_GENSALT_OUTPUT_SIZE (7 + 22 + 1)
28
30
 
@@ -234,7 +236,7 @@ char *__crypt_gensalt_ra(__CONST char *prefix, unsigned long count,
234
236
  input, size, output, sizeof(output));
235
237
 
236
238
  if (retval) {
237
- retval = strdup(retval);
239
+ retval = ruby_strdup(retval);
238
240
  #ifndef __GLIBC__
239
241
  /* strdup(3) on glibc sets errno, so we don't need to bother */
240
242
  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
data/lib/bcrypt_ext.jar CHANGED
Binary file
@@ -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,123 +1,108 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bcrypt-ruby
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
5
4
  prerelease:
6
- segments:
7
- - 3
8
- - 0
9
- - 0
10
- version: 3.0.0
5
+ version: 3.0.1
11
6
  platform: java
12
7
  authors:
13
- - Coda Hale
8
+ - Coda Hale
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2011-08-24 00:00:00 Z
13
+ date: 2011-09-12 00:00:00 -07:00
14
+ default_executable:
19
15
  dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: rake-compiler
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 0
31
- version: "0"
32
- type: :development
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: rspec
36
- prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
38
- none: false
39
- requirements:
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- hash: 3
43
- segments:
44
- - 0
45
- version: "0"
46
- type: :development
47
- version_requirements: *id002
16
+ - !ruby/object:Gem::Dependency
17
+ name: rake-compiler
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: "0"
25
+ type: :development
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ prerelease: false
30
+ requirement: &id002 !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: "0"
36
+ type: :development
37
+ version_requirements: *id002
48
38
  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"
49
39
  email: coda.hale@gmail.com
50
40
  executables: []
51
41
 
52
- extensions:
53
- - ext/mri/extconf.rb
42
+ extensions: []
43
+
54
44
  extra_rdoc_files:
55
- - README.md
56
- - COPYING
57
- - CHANGELOG
58
- - lib/bcrypt.rb
59
- - lib/bcrypt_engine.rb
45
+ - README.md
46
+ - COPYING
47
+ - CHANGELOG
48
+ - lib/bcrypt.rb
49
+ - lib/bcrypt_engine.rb
60
50
  files:
61
- - .gitignore
62
- - .rspec
63
- - CHANGELOG
64
- - COPYING
65
- - Gemfile
66
- - Gemfile.lock
67
- - README.md
68
- - Rakefile
69
- - bcrypt-ruby.gemspec
70
- - ext/jruby/bcrypt_jruby/BCrypt.java
71
- - ext/mri/bcrypt_ext.c
72
- - ext/mri/crypt.c
73
- - ext/mri/crypt.h
74
- - ext/mri/crypt_blowfish.c
75
- - ext/mri/crypt_gensalt.c
76
- - ext/mri/extconf.rb
77
- - ext/mri/ow-crypt.h
78
- - ext/mri/wrapper.c
79
- - lib/bcrypt.rb
80
- - lib/bcrypt_engine.rb
81
- - spec/TestBCrypt.java
82
- - spec/bcrypt/engine_spec.rb
83
- - spec/bcrypt/password_spec.rb
84
- - spec/spec_helper.rb
85
- - lib/bcrypt_ext.jar
51
+ - .gitignore
52
+ - .rspec
53
+ - CHANGELOG
54
+ - COPYING
55
+ - Gemfile
56
+ - Gemfile.lock
57
+ - README.md
58
+ - Rakefile
59
+ - bcrypt-ruby.gemspec
60
+ - ext/jruby/bcrypt_jruby/BCrypt.java
61
+ - ext/mri/bcrypt_ext.c
62
+ - ext/mri/crypt.c
63
+ - ext/mri/crypt.h
64
+ - ext/mri/crypt_blowfish.c
65
+ - ext/mri/crypt_gensalt.c
66
+ - ext/mri/extconf.rb
67
+ - ext/mri/ow-crypt.h
68
+ - ext/mri/wrapper.c
69
+ - lib/bcrypt.rb
70
+ - lib/bcrypt_engine.rb
71
+ - spec/TestBCrypt.java
72
+ - spec/bcrypt/engine_spec.rb
73
+ - spec/bcrypt/password_spec.rb
74
+ - spec/spec_helper.rb
75
+ - lib/bcrypt_ext.jar
76
+ has_rdoc: true
86
77
  homepage: http://bcrypt-ruby.rubyforge.org
87
78
  licenses: []
88
79
 
89
80
  post_install_message:
90
81
  rdoc_options:
91
- - --title
92
- - bcrypt-ruby
93
- - --line-numbers
94
- - --inline-source
95
- - --main
96
- - README.md
82
+ - --title
83
+ - bcrypt-ruby
84
+ - --line-numbers
85
+ - --inline-source
86
+ - --main
87
+ - README.md
97
88
  require_paths:
98
- - lib
89
+ - lib
99
90
  required_ruby_version: !ruby/object:Gem::Requirement
100
91
  none: false
101
92
  requirements:
102
- - - ">="
103
- - !ruby/object:Gem::Version
104
- hash: 3
105
- segments:
106
- - 0
107
- version: "0"
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: "0"
108
96
  required_rubygems_version: !ruby/object:Gem::Requirement
109
97
  none: false
110
98
  requirements:
111
- - - ">="
112
- - !ruby/object:Gem::Version
113
- hash: 3
114
- segments:
115
- - 0
116
- version: "0"
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: "0"
117
102
  requirements: []
118
103
 
119
104
  rubyforge_project: bcrypt-ruby
120
- rubygems_version: 1.8.8
105
+ rubygems_version: 1.5.1
121
106
  signing_key:
122
107
  specification_version: 3
123
108
  summary: OpenBSD's bcrypt() password hashing algorithm.