bcrypt 3.1.7-x86-mingw32 → 3.1.8-x86-mingw32
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/.gitignore +4 -5
 - data/.travis.yml +0 -1
 - data/CHANGELOG +3 -0
 - data/Gemfile.lock +15 -10
 - data/README.md +1 -1
 - data/Rakefile +26 -6
 - data/bcrypt.gemspec +2 -2
 - data/ext/mri/extconf.rb +0 -1
 - data/lib/bcrypt.rb +1 -6
 - data/spec/bcrypt/engine_spec.rb +15 -15
 - data/spec/bcrypt/error_spec.rb +2 -2
 - data/spec/bcrypt/password_spec.rb +29 -29
 - metadata +12 -9
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- 
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA512: 
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: a1b08077a41eaa706d38a5e91d2641be692ff36af4743614097f402174d7964b33f466bc37fc03fee164980882d8e35f7fb2966bda794e1013220ab282345023
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 2632abd658f9ece196e0f8409905101c670cad172471da7dc5b8aa31239fa10e58d6403bda88d328a40c97ce31a597582201e29a813065ca107ccd2982e310f7
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA1: 
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: cc03cf6d22c79123a6d89e2b25b2fc2618ed793e
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: c23360ef2d2eb87e60e74e2ab0aef74718336f68
         
     | 
    
        data/.gitignore
    CHANGED
    
    
    
        data/.travis.yml
    CHANGED
    
    
    
        data/CHANGELOG
    CHANGED
    
    
    
        data/Gemfile.lock
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            PATH
         
     | 
| 
       2 
2 
     | 
    
         
             
              remote: .
         
     | 
| 
       3 
3 
     | 
    
         
             
              specs:
         
     | 
| 
       4 
     | 
    
         
            -
                bcrypt (3.1. 
     | 
| 
      
 4 
     | 
    
         
            +
                bcrypt (3.1.8)
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            GEM
         
     | 
| 
       7 
7 
     | 
    
         
             
              remote: https://rubygems.org/
         
     | 
| 
         @@ -14,22 +14,27 @@ GEM 
     | 
|
| 
       14 
14 
     | 
    
         
             
                  rake
         
     | 
| 
       15 
15 
     | 
    
         
             
                rdoc (3.12.2)
         
     | 
| 
       16 
16 
     | 
    
         
             
                  json (~> 1.4)
         
     | 
| 
       17 
     | 
    
         
            -
                rspec ( 
     | 
| 
       18 
     | 
    
         
            -
                  rspec-core (~>  
     | 
| 
       19 
     | 
    
         
            -
                  rspec-expectations (~>  
     | 
| 
       20 
     | 
    
         
            -
                  rspec-mocks (~>  
     | 
| 
       21 
     | 
    
         
            -
                rspec-core ( 
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
      
 17 
     | 
    
         
            +
                rspec (3.0.0)
         
     | 
| 
      
 18 
     | 
    
         
            +
                  rspec-core (~> 3.0.0)
         
     | 
| 
      
 19 
     | 
    
         
            +
                  rspec-expectations (~> 3.0.0)
         
     | 
| 
      
 20 
     | 
    
         
            +
                  rspec-mocks (~> 3.0.0)
         
     | 
| 
      
 21 
     | 
    
         
            +
                rspec-core (3.0.2)
         
     | 
| 
      
 22 
     | 
    
         
            +
                  rspec-support (~> 3.0.0)
         
     | 
| 
      
 23 
     | 
    
         
            +
                rspec-expectations (3.0.2)
         
     | 
| 
      
 24 
     | 
    
         
            +
                  diff-lcs (>= 1.2.0, < 2.0)
         
     | 
| 
      
 25 
     | 
    
         
            +
                  rspec-support (~> 3.0.0)
         
     | 
| 
      
 26 
     | 
    
         
            +
                rspec-mocks (3.0.2)
         
     | 
| 
      
 27 
     | 
    
         
            +
                  rspec-support (~> 3.0.0)
         
     | 
| 
      
 28 
     | 
    
         
            +
                rspec-support (3.0.2)
         
     | 
| 
       25 
29 
     | 
    
         | 
| 
       26 
30 
     | 
    
         
             
            PLATFORMS
         
     | 
| 
       27 
31 
     | 
    
         
             
              java
         
     | 
| 
       28 
32 
     | 
    
         
             
              ruby
         
     | 
| 
      
 33 
     | 
    
         
            +
              x64-mingw32
         
     | 
| 
       29 
34 
     | 
    
         
             
              x86-mingw32
         
     | 
| 
       30 
35 
     | 
    
         | 
| 
       31 
36 
     | 
    
         
             
            DEPENDENCIES
         
     | 
| 
       32 
37 
     | 
    
         
             
              bcrypt!
         
     | 
| 
       33 
38 
     | 
    
         
             
              rake-compiler (~> 0.9.2)
         
     | 
| 
       34 
39 
     | 
    
         
             
              rdoc (~> 3.12)
         
     | 
| 
       35 
     | 
    
         
            -
              rspec
         
     | 
| 
      
 40 
     | 
    
         
            +
              rspec (>= 3)
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -30,7 +30,7 @@ re-hash those passwords. This vulnerability only affected the JRuby gem. 
     | 
|
| 
       30 
30 
     | 
    
         
             
            The bcrypt gem is available on the following ruby platforms:
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
       32 
32 
     | 
    
         
             
            * JRuby
         
     | 
| 
       33 
     | 
    
         
            -
            * RubyInstaller 1.8, 1.9, and 2. 
     | 
| 
      
 33 
     | 
    
         
            +
            * RubyInstaller 1.8, 1.9, 2.0, and 2.1 builds on win32
         
     | 
| 
       34 
34 
     | 
    
         
             
            * Any 1.8, 1.9, 2.0, or 2.1 ruby on a BSD/OSX/Linux system with a compiler
         
     | 
| 
       35 
35 
     | 
    
         | 
| 
       36 
36 
     | 
    
         
             
            ## How to use `bcrypt()` in your Rails application
         
     | 
    
        data/Rakefile
    CHANGED
    
    | 
         @@ -7,16 +7,19 @@ require 'rdoc/task' 
     | 
|
| 
       7 
7 
     | 
    
         
             
            require 'benchmark'
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
            CLEAN.include(
         
     | 
| 
       10 
     | 
    
         
            -
              " 
     | 
| 
       11 
     | 
    
         
            -
              " 
     | 
| 
       12 
     | 
    
         
            -
              " 
     | 
| 
       13 
     | 
    
         
            -
              " 
     | 
| 
      
 10 
     | 
    
         
            +
              "tmp",
         
     | 
| 
      
 11 
     | 
    
         
            +
              "lib/1.8",
         
     | 
| 
      
 12 
     | 
    
         
            +
              "lib/1.9",
         
     | 
| 
      
 13 
     | 
    
         
            +
              "lib/2.0",
         
     | 
| 
      
 14 
     | 
    
         
            +
              "lib/2.1",
         
     | 
| 
      
 15 
     | 
    
         
            +
              "lib/bcrypt_ext.jar",
         
     | 
| 
      
 16 
     | 
    
         
            +
              "lib/bcrypt_ext.so"
         
     | 
| 
       14 
17 
     | 
    
         
             
            )
         
     | 
| 
       15 
18 
     | 
    
         
             
            CLOBBER.include(
         
     | 
| 
       16 
     | 
    
         
            -
              " 
     | 
| 
       17 
     | 
    
         
            -
              "doc/coverage",
         
     | 
| 
      
 19 
     | 
    
         
            +
              "doc",
         
     | 
| 
       18 
20 
     | 
    
         
             
              "pkg"
         
     | 
| 
       19 
21 
     | 
    
         
             
            )
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
       20 
23 
     | 
    
         
             
            GEMSPEC = Gem::Specification.load("bcrypt.gemspec")
         
     | 
| 
       21 
24 
     | 
    
         | 
| 
       22 
25 
     | 
    
         
             
            task :default => [:compile, :spec]
         
     | 
| 
         @@ -58,6 +61,23 @@ else 
     | 
|
| 
       58 
61 
     | 
    
         
             
                ext.cross_compile = true
         
     | 
| 
       59 
62 
     | 
    
         
             
                ext.cross_platform = ['x86-mingw32', 'x64-mingw32']
         
     | 
| 
       60 
63 
     | 
    
         
             
              end
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
              ENV['RUBY_CC_VERSION'].to_s.split(':').each do |ruby_version|
         
     | 
| 
      
 66 
     | 
    
         
            +
                platforms = {
         
     | 
| 
      
 67 
     | 
    
         
            +
                  "x86-mingw32" => "i686-w64-mingw32",
         
     | 
| 
      
 68 
     | 
    
         
            +
                  "x64-mingw32" => "x86_64-w64-mingw32"
         
     | 
| 
      
 69 
     | 
    
         
            +
                }
         
     | 
| 
      
 70 
     | 
    
         
            +
                platforms.each do |platform, prefix|
         
     | 
| 
      
 71 
     | 
    
         
            +
                  task "copy:bcrypt_ext:#{platform}:#{ruby_version}" do |t|
         
     | 
| 
      
 72 
     | 
    
         
            +
                    %w[lib tmp/#{platform}/stage/lib].each do |dir|
         
     | 
| 
      
 73 
     | 
    
         
            +
                      so_file = "#{dir}/#{ruby_version[/^\d+\.\d+/]}/bcrypt_ext.so"
         
     | 
| 
      
 74 
     | 
    
         
            +
                      if File.exists?(so_file)
         
     | 
| 
      
 75 
     | 
    
         
            +
                        sh "#{prefix}-strip -S #{so_file}"
         
     | 
| 
      
 76 
     | 
    
         
            +
                      end
         
     | 
| 
      
 77 
     | 
    
         
            +
                    end
         
     | 
| 
      
 78 
     | 
    
         
            +
                  end
         
     | 
| 
      
 79 
     | 
    
         
            +
                end
         
     | 
| 
      
 80 
     | 
    
         
            +
              end
         
     | 
| 
       61 
81 
     | 
    
         
             
            end
         
     | 
| 
       62 
82 
     | 
    
         | 
| 
       63 
83 
     | 
    
         
             
            desc "Run a set of benchmarks on the compiled extension."
         
     | 
    
        data/bcrypt.gemspec
    CHANGED
    
    | 
         @@ -1,6 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            Gem::Specification.new do |s|
         
     | 
| 
       2 
2 
     | 
    
         
             
              s.name = 'bcrypt'
         
     | 
| 
       3 
     | 
    
         
            -
              s.version = '3.1. 
     | 
| 
      
 3 
     | 
    
         
            +
              s.version = '3.1.8'
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
              s.summary = "OpenBSD's bcrypt() password hashing algorithm."
         
     | 
| 
       6 
6 
     | 
    
         
             
              s.description = <<-EOF
         
     | 
| 
         @@ -13,7 +13,7 @@ Gem::Specification.new do |s| 
     | 
|
| 
       13 
13 
     | 
    
         
             
              s.require_path = 'lib'
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
              s.add_development_dependency 'rake-compiler', '~> 0.9.2'
         
     | 
| 
       16 
     | 
    
         
            -
              s.add_development_dependency 'rspec'
         
     | 
| 
      
 16 
     | 
    
         
            +
              s.add_development_dependency 'rspec', '>= 3'
         
     | 
| 
       17 
17 
     | 
    
         
             
              s.add_development_dependency 'rdoc', '~> 3.12'
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
              s.has_rdoc = true
         
     | 
    
        data/ext/mri/extconf.rb
    CHANGED
    
    
    
        data/lib/bcrypt.rb
    CHANGED
    
    
    
        data/spec/bcrypt/engine_spec.rb
    CHANGED
    
    | 
         @@ -4,35 +4,35 @@ describe "The BCrypt engine" do 
     | 
|
| 
       4 
4 
     | 
    
         
             
              specify "should calculate the optimal cost factor to fit in a specific time" do
         
     | 
| 
       5 
5 
     | 
    
         
             
                first = BCrypt::Engine.calibrate(100)
         
     | 
| 
       6 
6 
     | 
    
         
             
                second = BCrypt::Engine.calibrate(400)
         
     | 
| 
       7 
     | 
    
         
            -
                second. 
     | 
| 
      
 7 
     | 
    
         
            +
                expect(second).to be > first
         
     | 
| 
       8 
8 
     | 
    
         
             
              end
         
     | 
| 
       9 
9 
     | 
    
         
             
            end
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
11 
     | 
    
         
             
            describe "Generating BCrypt salts" do
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
              specify "should produce strings" do
         
     | 
| 
       14 
     | 
    
         
            -
                BCrypt::Engine.generate_salt. 
     | 
| 
      
 14 
     | 
    
         
            +
                expect(BCrypt::Engine.generate_salt).to be_an_instance_of(String)
         
     | 
| 
       15 
15 
     | 
    
         
             
              end
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
              specify "should produce random data" do
         
     | 
| 
       18 
     | 
    
         
            -
                BCrypt::Engine.generate_salt. 
     | 
| 
      
 18 
     | 
    
         
            +
                expect(BCrypt::Engine.generate_salt).to_not equal(BCrypt::Engine.generate_salt)
         
     | 
| 
       19 
19 
     | 
    
         
             
              end
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         
             
              specify "should raise a InvalidCostError if the cost parameter isn't numeric" do
         
     | 
| 
       22 
     | 
    
         
            -
                 
     | 
| 
      
 22 
     | 
    
         
            +
                expect { BCrypt::Engine.generate_salt('woo') }.to raise_error(BCrypt::Errors::InvalidCost)
         
     | 
| 
       23 
23 
     | 
    
         
             
              end
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
25 
     | 
    
         
             
              specify "should raise a InvalidCostError if the cost parameter isn't greater than 0" do
         
     | 
| 
       26 
     | 
    
         
            -
                 
     | 
| 
      
 26 
     | 
    
         
            +
                expect { BCrypt::Engine.generate_salt(-1) }.to raise_error(BCrypt::Errors::InvalidCost)
         
     | 
| 
       27 
27 
     | 
    
         
             
              end
         
     | 
| 
       28 
28 
     | 
    
         
             
            end
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
       30 
30 
     | 
    
         
             
            describe "Autodetecting of salt cost" do
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
       32 
32 
     | 
    
         
             
              specify "should work" do
         
     | 
| 
       33 
     | 
    
         
            -
                BCrypt::Engine.autodetect_cost("$2a$08$hRx2IVeHNsTSYYtUWn61Ou"). 
     | 
| 
       34 
     | 
    
         
            -
                BCrypt::Engine.autodetect_cost("$2a$05$XKd1bMnLgUnc87qvbAaCUu"). 
     | 
| 
       35 
     | 
    
         
            -
                BCrypt::Engine.autodetect_cost("$2a$13$Lni.CZ6z5A7344POTFBBV."). 
     | 
| 
      
 33 
     | 
    
         
            +
                expect(BCrypt::Engine.autodetect_cost("$2a$08$hRx2IVeHNsTSYYtUWn61Ou")).to eq 8
         
     | 
| 
      
 34 
     | 
    
         
            +
                expect(BCrypt::Engine.autodetect_cost("$2a$05$XKd1bMnLgUnc87qvbAaCUu")).to eq 5
         
     | 
| 
      
 35 
     | 
    
         
            +
                expect(BCrypt::Engine.autodetect_cost("$2a$13$Lni.CZ6z5A7344POTFBBV.")).to eq 13
         
     | 
| 
       36 
36 
     | 
    
         
             
              end
         
     | 
| 
       37 
37 
     | 
    
         | 
| 
       38 
38 
     | 
    
         
             
            end
         
     | 
| 
         @@ -49,21 +49,21 @@ describe "Generating BCrypt hashes" do 
     | 
|
| 
       49 
49 
     | 
    
         
             
              end
         
     | 
| 
       50 
50 
     | 
    
         | 
| 
       51 
51 
     | 
    
         
             
              specify "should produce a string" do
         
     | 
| 
       52 
     | 
    
         
            -
                BCrypt::Engine.hash_secret(@password, @salt). 
     | 
| 
      
 52 
     | 
    
         
            +
                expect(BCrypt::Engine.hash_secret(@password, @salt)).to be_an_instance_of(String)
         
     | 
| 
       53 
53 
     | 
    
         
             
              end
         
     | 
| 
       54 
54 
     | 
    
         | 
| 
       55 
55 
     | 
    
         
             
              specify "should raise an InvalidSalt error if the salt is invalid" do
         
     | 
| 
       56 
     | 
    
         
            -
                 
     | 
| 
      
 56 
     | 
    
         
            +
                expect { BCrypt::Engine.hash_secret(@password, 'nino') }.to raise_error(BCrypt::Errors::InvalidSalt)
         
     | 
| 
       57 
57 
     | 
    
         
             
              end
         
     | 
| 
       58 
58 
     | 
    
         | 
| 
       59 
59 
     | 
    
         
             
              specify "should raise an InvalidSecret error if the secret is invalid" do
         
     | 
| 
       60 
     | 
    
         
            -
                 
     | 
| 
       61 
     | 
    
         
            -
                 
     | 
| 
       62 
     | 
    
         
            -
                 
     | 
| 
      
 60 
     | 
    
         
            +
                expect { BCrypt::Engine.hash_secret(MyInvalidSecret.new, @salt) }.to raise_error(BCrypt::Errors::InvalidSecret)
         
     | 
| 
      
 61 
     | 
    
         
            +
                expect { BCrypt::Engine.hash_secret(nil, @salt) }.not_to raise_error
         
     | 
| 
      
 62 
     | 
    
         
            +
                expect { BCrypt::Engine.hash_secret(false, @salt) }.not_to raise_error
         
     | 
| 
       63 
63 
     | 
    
         
             
              end
         
     | 
| 
       64 
64 
     | 
    
         | 
| 
       65 
65 
     | 
    
         
             
              specify "should call #to_s on the secret and use the return value as the actual secret data" do
         
     | 
| 
       66 
     | 
    
         
            -
                BCrypt::Engine.hash_secret(false, @salt). 
     | 
| 
      
 66 
     | 
    
         
            +
                expect(BCrypt::Engine.hash_secret(false, @salt)).to eq BCrypt::Engine.hash_secret("false", @salt)
         
     | 
| 
       67 
67 
     | 
    
         
             
              end
         
     | 
| 
       68 
68 
     | 
    
         | 
| 
       69 
69 
     | 
    
         
             
              specify "should be interoperable with other implementations" do
         
     | 
| 
         @@ -76,7 +76,7 @@ describe "Generating BCrypt hashes" do 
     | 
|
| 
       76 
76 
     | 
    
         
             
                  ["0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", "$2a$05$abcdefghijklmnopqrstuu", "$2a$05$abcdefghijklmnopqrstuu5s2v8.iXieOjg/.AySBTTZIIVFJeBui"]
         
     | 
| 
       77 
77 
     | 
    
         
             
                ]
         
     | 
| 
       78 
78 
     | 
    
         
             
                for secret, salt, test_vector in test_vectors
         
     | 
| 
       79 
     | 
    
         
            -
                  BCrypt::Engine.hash_secret(secret, salt). 
     | 
| 
      
 79 
     | 
    
         
            +
                  expect(BCrypt::Engine.hash_secret(secret, salt)).to eql(test_vector)
         
     | 
| 
       80 
80 
     | 
    
         
             
                end
         
     | 
| 
       81 
81 
     | 
    
         
             
              end
         
     | 
| 
       82 
82 
     | 
    
         
             
            end
         
     | 
    
        data/spec/bcrypt/error_spec.rb
    CHANGED
    
    | 
         @@ -4,13 +4,13 @@ describe "Errors" do 
     | 
|
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
              shared_examples "descends from StandardError" do
         
     | 
| 
       6 
6 
     | 
    
         
             
                it "can be rescued as a StandardError" do
         
     | 
| 
       7 
     | 
    
         
            -
                  described_class. 
     | 
| 
      
 7 
     | 
    
         
            +
                  expect(described_class).to be < StandardError
         
     | 
| 
       8 
8 
     | 
    
         
             
                end
         
     | 
| 
       9 
9 
     | 
    
         
             
              end
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
11 
     | 
    
         
             
              shared_examples "descends from BCrypt::Error" do
         
     | 
| 
       12 
12 
     | 
    
         
             
                it "can be rescued as a BCrypt::Error" do
         
     | 
| 
       13 
     | 
    
         
            -
                  described_class. 
     | 
| 
      
 13 
     | 
    
         
            +
                  expect(described_class).to be < BCrypt::Error
         
     | 
| 
       14 
14 
     | 
    
         
             
                end
         
     | 
| 
       15 
15 
     | 
    
         
             
              end
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
         @@ -8,23 +8,23 @@ describe "Creating a hashed password" do 
     | 
|
| 
       8 
8 
     | 
    
         
             
              end
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
              specify "should return a BCrypt::Password" do
         
     | 
| 
       11 
     | 
    
         
            -
                @password. 
     | 
| 
      
 11 
     | 
    
         
            +
                expect(@password).to be_an_instance_of(BCrypt::Password)
         
     | 
| 
       12 
12 
     | 
    
         
             
              end
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
              specify "should return a valid bcrypt password" do
         
     | 
| 
       15 
     | 
    
         
            -
                 
     | 
| 
      
 15 
     | 
    
         
            +
                expect { BCrypt::Password.new(@password) }.not_to raise_error
         
     | 
| 
       16 
16 
     | 
    
         
             
              end
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         
             
              specify "should behave normally if the secret is not a string" do
         
     | 
| 
       19 
     | 
    
         
            -
                 
     | 
| 
       20 
     | 
    
         
            -
                 
     | 
| 
       21 
     | 
    
         
            -
                 
     | 
| 
      
 19 
     | 
    
         
            +
                expect { BCrypt::Password.create(nil) }.not_to raise_error
         
     | 
| 
      
 20 
     | 
    
         
            +
                expect { BCrypt::Password.create({:woo => "yeah"}) }.not_to raise_error
         
     | 
| 
      
 21 
     | 
    
         
            +
                expect { BCrypt::Password.create(false) }.not_to raise_error
         
     | 
| 
       22 
22 
     | 
    
         
             
              end
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
24 
     | 
    
         
             
              specify "should tolerate empty string secrets" do
         
     | 
| 
       25 
     | 
    
         
            -
                 
     | 
| 
       26 
     | 
    
         
            -
                 
     | 
| 
       27 
     | 
    
         
            -
                 
     | 
| 
      
 25 
     | 
    
         
            +
                expect { BCrypt::Password.create( "\n".chop  ) }.not_to raise_error
         
     | 
| 
      
 26 
     | 
    
         
            +
                expect { BCrypt::Password.create( ""         ) }.not_to raise_error
         
     | 
| 
      
 27 
     | 
    
         
            +
                expect { BCrypt::Password.create( String.new ) }.not_to raise_error
         
     | 
| 
       28 
28 
     | 
    
         
             
              end
         
     | 
| 
       29 
29 
     | 
    
         
             
            end
         
     | 
| 
       30 
30 
     | 
    
         | 
| 
         @@ -35,26 +35,26 @@ describe "Reading a hashed password" do 
     | 
|
| 
       35 
35 
     | 
    
         
             
              end
         
     | 
| 
       36 
36 
     | 
    
         | 
| 
       37 
37 
     | 
    
         
             
              specify "the cost is too damn high" do
         
     | 
| 
       38 
     | 
    
         
            -
                 
     | 
| 
      
 38 
     | 
    
         
            +
                expect {
         
     | 
| 
       39 
39 
     | 
    
         
             
                  BCrypt::Password.create("hello", :cost => 32)
         
     | 
| 
       40 
     | 
    
         
            -
                }. 
     | 
| 
      
 40 
     | 
    
         
            +
                }.to raise_error(ArgumentError)
         
     | 
| 
       41 
41 
     | 
    
         
             
              end
         
     | 
| 
       42 
42 
     | 
    
         | 
| 
       43 
43 
     | 
    
         
             
              specify "the cost should be set to the default if nil" do
         
     | 
| 
       44 
     | 
    
         
            -
                BCrypt::Password.create("hello", :cost => nil).cost. 
     | 
| 
      
 44 
     | 
    
         
            +
                expect(BCrypt::Password.create("hello", :cost => nil).cost).to equal(BCrypt::Engine::DEFAULT_COST)
         
     | 
| 
       45 
45 
     | 
    
         
             
              end
         
     | 
| 
       46 
46 
     | 
    
         | 
| 
       47 
47 
     | 
    
         
             
              specify "the cost should be set to the default if empty hash" do
         
     | 
| 
       48 
     | 
    
         
            -
                BCrypt::Password.create("hello", {}).cost. 
     | 
| 
      
 48 
     | 
    
         
            +
                expect(BCrypt::Password.create("hello", {}).cost).to equal(BCrypt::Engine::DEFAULT_COST)
         
     | 
| 
       49 
49 
     | 
    
         
             
              end
         
     | 
| 
       50 
50 
     | 
    
         | 
| 
       51 
51 
     | 
    
         
             
              specify "the cost should be set to the passed value if provided" do
         
     | 
| 
       52 
     | 
    
         
            -
                BCrypt::Password.create("hello", :cost => 5).cost. 
     | 
| 
      
 52 
     | 
    
         
            +
                expect(BCrypt::Password.create("hello", :cost => 5).cost).to equal(5)
         
     | 
| 
       53 
53 
     | 
    
         
             
              end
         
     | 
| 
       54 
54 
     | 
    
         | 
| 
       55 
55 
     | 
    
         
             
              specify "the cost should be set to the global value if set" do
         
     | 
| 
       56 
56 
     | 
    
         
             
                BCrypt::Engine.cost = 5
         
     | 
| 
       57 
     | 
    
         
            -
                BCrypt::Password.create("hello").cost. 
     | 
| 
      
 57 
     | 
    
         
            +
                expect(BCrypt::Password.create("hello").cost).to equal(5)
         
     | 
| 
       58 
58 
     | 
    
         
             
                # unset the global value to not affect other tests
         
     | 
| 
       59 
59 
     | 
    
         
             
                BCrypt::Engine.cost = nil
         
     | 
| 
       60 
60 
     | 
    
         
             
              end
         
     | 
| 
         @@ -65,7 +65,7 @@ describe "Reading a hashed password" do 
     | 
|
| 
       65 
65 
     | 
    
         
             
                old_default_cost = BCrypt::Engine::DEFAULT_COST
         
     | 
| 
       66 
66 
     | 
    
         | 
| 
       67 
67 
     | 
    
         
             
                BCrypt::Engine::DEFAULT_COST = 5
         
     | 
| 
       68 
     | 
    
         
            -
                BCrypt::Password.create("hello").cost. 
     | 
| 
      
 68 
     | 
    
         
            +
                expect(BCrypt::Password.create("hello").cost).to equal(5)
         
     | 
| 
       69 
69 
     | 
    
         | 
| 
       70 
70 
     | 
    
         
             
                # reset default to not affect other tests
         
     | 
| 
       71 
71 
     | 
    
         
             
                BCrypt::Engine::DEFAULT_COST = old_default_cost
         
     | 
| 
         @@ -74,17 +74,17 @@ describe "Reading a hashed password" do 
     | 
|
| 
       74 
74 
     | 
    
         | 
| 
       75 
75 
     | 
    
         
             
              specify "should read the version, cost, salt, and hash" do
         
     | 
| 
       76 
76 
     | 
    
         
             
                password = BCrypt::Password.new(@hash)
         
     | 
| 
       77 
     | 
    
         
            -
                password.version. 
     | 
| 
       78 
     | 
    
         
            -
                password.cost. 
     | 
| 
       79 
     | 
    
         
            -
                password.salt. 
     | 
| 
       80 
     | 
    
         
            -
                password.salt.class. 
     | 
| 
       81 
     | 
    
         
            -
                password.checksum. 
     | 
| 
       82 
     | 
    
         
            -
                password.checksum.class. 
     | 
| 
       83 
     | 
    
         
            -
                password.to_s. 
     | 
| 
      
 77 
     | 
    
         
            +
                expect(password.version).to eql("2a")
         
     | 
| 
      
 78 
     | 
    
         
            +
                expect(password.cost).to equal(5)
         
     | 
| 
      
 79 
     | 
    
         
            +
                expect(password.salt).to eql("$2a$05$CCCCCCCCCCCCCCCCCCCCC.")
         
     | 
| 
      
 80 
     | 
    
         
            +
                expect(password.salt.class).to eq String
         
     | 
| 
      
 81 
     | 
    
         
            +
                expect(password.checksum).to eq("E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW")
         
     | 
| 
      
 82 
     | 
    
         
            +
                expect(password.checksum.class).to eq String
         
     | 
| 
      
 83 
     | 
    
         
            +
                expect(password.to_s).to eql(@hash)
         
     | 
| 
       84 
84 
     | 
    
         
             
              end
         
     | 
| 
       85 
85 
     | 
    
         | 
| 
       86 
86 
     | 
    
         
             
              specify "should raise an InvalidHashError when given an invalid hash" do
         
     | 
| 
       87 
     | 
    
         
            -
                 
     | 
| 
      
 87 
     | 
    
         
            +
                expect { BCrypt::Password.new('weedle') }.to raise_error(BCrypt::Errors::InvalidHash)
         
     | 
| 
       88 
88 
     | 
    
         
             
              end
         
     | 
| 
       89 
89 
     | 
    
         
             
            end
         
     | 
| 
       90 
90 
     | 
    
         | 
| 
         @@ -96,28 +96,28 @@ describe "Comparing a hashed password with a secret" do 
     | 
|
| 
       96 
96 
     | 
    
         
             
              end
         
     | 
| 
       97 
97 
     | 
    
         | 
| 
       98 
98 
     | 
    
         
             
              specify "should compare successfully to the original secret" do
         
     | 
| 
       99 
     | 
    
         
            -
                (@password == @secret). 
     | 
| 
      
 99 
     | 
    
         
            +
                expect((@password == @secret)).to be(true)
         
     | 
| 
       100 
100 
     | 
    
         
             
              end
         
     | 
| 
       101 
101 
     | 
    
         | 
| 
       102 
102 
     | 
    
         
             
              specify "should compare unsuccessfully to anything besides original secret" do
         
     | 
| 
       103 
     | 
    
         
            -
                (@password == "@secret"). 
     | 
| 
      
 103 
     | 
    
         
            +
                expect((@password == "@secret")).to be(false)
         
     | 
| 
       104 
104 
     | 
    
         
             
              end
         
     | 
| 
       105 
105 
     | 
    
         
             
            end
         
     | 
| 
       106 
106 
     | 
    
         | 
| 
       107 
107 
     | 
    
         
             
            describe "Validating a generated salt" do
         
     | 
| 
       108 
108 
     | 
    
         
             
              specify "should not accept an invalid salt" do
         
     | 
| 
       109 
     | 
    
         
            -
                BCrypt::Engine.valid_salt?("invalid"). 
     | 
| 
      
 109 
     | 
    
         
            +
                expect(BCrypt::Engine.valid_salt?("invalid")).to eq(false)
         
     | 
| 
       110 
110 
     | 
    
         
             
              end
         
     | 
| 
       111 
111 
     | 
    
         
             
              specify "should accept a valid salt" do
         
     | 
| 
       112 
     | 
    
         
            -
                BCrypt::Engine.valid_salt?(BCrypt::Engine.generate_salt). 
     | 
| 
      
 112 
     | 
    
         
            +
                expect(BCrypt::Engine.valid_salt?(BCrypt::Engine.generate_salt)).to eq(true)
         
     | 
| 
       113 
113 
     | 
    
         
             
              end
         
     | 
| 
       114 
114 
     | 
    
         
             
            end
         
     | 
| 
       115 
115 
     | 
    
         | 
| 
       116 
116 
     | 
    
         
             
            describe "Validating a password hash" do
         
     | 
| 
       117 
117 
     | 
    
         
             
              specify "should not accept an invalid password" do
         
     | 
| 
       118 
     | 
    
         
            -
                BCrypt::Password.valid_hash?("i_am_so_not_valid"). 
     | 
| 
      
 118 
     | 
    
         
            +
                expect(BCrypt::Password.valid_hash?("i_am_so_not_valid")).to be_falsey
         
     | 
| 
       119 
119 
     | 
    
         
             
              end
         
     | 
| 
       120 
120 
     | 
    
         
             
              specify "should accept a valid password" do
         
     | 
| 
       121 
     | 
    
         
            -
                BCrypt::Password.valid_hash?(BCrypt::Password.create "i_am_so_valid"). 
     | 
| 
      
 121 
     | 
    
         
            +
                expect(BCrypt::Password.valid_hash?(BCrypt::Password.create "i_am_so_valid")).to be_truthy
         
     | 
| 
       122 
122 
     | 
    
         
             
              end
         
     | 
| 
       123 
123 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       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.8
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: x86-mingw32
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors: 
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Coda Hale
         
     | 
| 
         @@ -9,7 +9,7 @@ autorequire: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
            date: 2014- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2014-10-23 00:00:00 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: rake-compiler
         
     | 
| 
         @@ -19,19 +19,18 @@ dependencies: 
     | 
|
| 
       19 
19 
     | 
    
         
             
                - - ~>
         
     | 
| 
       20 
20 
     | 
    
         
             
                  - !ruby/object:Gem::Version 
         
     | 
| 
       21 
21 
     | 
    
         
             
                    version: 0.9.2
         
     | 
| 
       22 
     | 
    
         
            -
              type: :development
         
     | 
| 
       23 
22 
     | 
    
         
             
              version_requirements: *id001
         
     | 
| 
      
 23 
     | 
    
         
            +
              type: :development
         
     | 
| 
       24 
24 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
       25 
25 
     | 
    
         
             
              name: rspec
         
     | 
| 
       26 
26 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       27 
27 
     | 
    
         
             
              requirement: &id002 !ruby/object:Gem::Requirement 
         
     | 
| 
       28 
28 
     | 
    
         
             
                requirements: 
         
     | 
| 
       29 
     | 
    
         
            -
                -  
     | 
| 
       30 
     | 
    
         
            -
                  - ">="
         
     | 
| 
      
 29 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       31 
30 
     | 
    
         
             
                  - !ruby/object:Gem::Version 
         
     | 
| 
       32 
     | 
    
         
            -
                    version: " 
     | 
| 
       33 
     | 
    
         
            -
              type: :development
         
     | 
| 
      
 31 
     | 
    
         
            +
                    version: "3"
         
     | 
| 
       34 
32 
     | 
    
         
             
              version_requirements: *id002
         
     | 
| 
      
 33 
     | 
    
         
            +
              type: :development
         
     | 
| 
       35 
34 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
       36 
35 
     | 
    
         
             
              name: rdoc
         
     | 
| 
       37 
36 
     | 
    
         
             
              prerelease: false
         
     | 
| 
         @@ -40,8 +39,8 @@ dependencies: 
     | 
|
| 
       40 
39 
     | 
    
         
             
                - - ~>
         
     | 
| 
       41 
40 
     | 
    
         
             
                  - !ruby/object:Gem::Version 
         
     | 
| 
       42 
41 
     | 
    
         
             
                    version: "3.12"
         
     | 
| 
       43 
     | 
    
         
            -
              type: :development
         
     | 
| 
       44 
42 
     | 
    
         
             
              version_requirements: *id003
         
     | 
| 
      
 43 
     | 
    
         
            +
              type: :development
         
     | 
| 
       45 
44 
     | 
    
         
             
            description: "    bcrypt() is a sophisticated and secure hash algorithm designed by The OpenBSD project\n    for hashing passwords. The bcrypt Ruby gem provides a simple wrapper for safely handling\n    passwords.\n"
         
     | 
| 
       46 
45 
     | 
    
         
             
            email: coda.hale@gmail.com
         
     | 
| 
       47 
46 
     | 
    
         
             
            executables: []
         
     | 
| 
         @@ -88,6 +87,7 @@ files: 
     | 
|
| 
       88 
87 
     | 
    
         
             
            - lib/1.8/bcrypt_ext.so
         
     | 
| 
       89 
88 
     | 
    
         
             
            - lib/1.9/bcrypt_ext.so
         
     | 
| 
       90 
89 
     | 
    
         
             
            - lib/2.0/bcrypt_ext.so
         
     | 
| 
      
 90 
     | 
    
         
            +
            - lib/2.1/bcrypt_ext.so
         
     | 
| 
       91 
91 
     | 
    
         
             
            homepage: https://github.com/codahale/bcrypt-ruby
         
     | 
| 
       92 
92 
     | 
    
         
             
            licenses: 
         
     | 
| 
       93 
93 
     | 
    
         
             
            - MIT
         
     | 
| 
         @@ -105,7 +105,10 @@ require_paths: 
     | 
|
| 
       105 
105 
     | 
    
         
             
            - lib
         
     | 
| 
       106 
106 
     | 
    
         
             
            required_ruby_version: !ruby/object:Gem::Requirement 
         
     | 
| 
       107 
107 
     | 
    
         
             
              requirements: 
         
     | 
| 
       108 
     | 
    
         
            -
              -  
     | 
| 
      
 108 
     | 
    
         
            +
              - &id004 
         
     | 
| 
      
 109 
     | 
    
         
            +
                - ">="
         
     | 
| 
      
 110 
     | 
    
         
            +
                - !ruby/object:Gem::Version 
         
     | 
| 
      
 111 
     | 
    
         
            +
                  version: "0"
         
     | 
| 
       109 
112 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement 
         
     | 
| 
       110 
113 
     | 
    
         
             
              requirements: 
         
     | 
| 
       111 
114 
     | 
    
         
             
              - *id004
         
     |