Commit 3aa15b624d1372f5289a864fcdb20410bc9eb20f
Merge pull request #107 from mattwildig/version-attribute-string
Make version attribute a plain StringT.J. Schuck committed on 1/29/2015, 4:13:12 AM
Parent: b82c7140eb4ecedc20ab3a7c0d0801667d1907b3
Parent: f1621d686b6c41ae4157667b3f76735cfbbc60e5
Files changed
lib/bcrypt/password.rb | changed |
spec/bcrypt/password_spec.rb | changed |
lib/bcrypt/password.rb | ||
---|---|---|
@@ -79,9 +79,9 @@ | ||
79 | 79 | # |
80 | 80 | # Splits +h+ into version, cost, salt, and hash and returns them in that order. |
81 | 81 | def split_hash(h) |
82 | 82 | _, v, c, mash = h.split('$') |
83 | - return v, c.to_i, h[0, 29].to_str, mash[-31, 31].to_str | |
83 | + return v.to_str, c.to_i, h[0, 29].to_str, mash[-31, 31].to_str | |
84 | 84 | end |
85 | 85 | end |
86 | 86 | |
87 | 87 | end |
spec/bcrypt/password_spec.rb | ||
---|---|---|
@@ -74,8 +74,9 @@ | ||
74 | 74 | |
75 | 75 | specify "should read the version, cost, salt, and hash" do |
76 | 76 | password = BCrypt::Password.new(@hash) |
77 | 77 | expect(password.version).to eql("2a") |
78 | + expect(password.version.class).to eq String | |
78 | 79 | expect(password.cost).to equal(5) |
79 | 80 | expect(password.salt).to eql("$2a$05$CCCCCCCCCCCCCCCCCCCCC.") |
80 | 81 | expect(password.salt.class).to eq String |
81 | 82 | expect(password.checksum).to eq("E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW") |
Built with git-ssb-web