git ssb

0+

dangerousbeans / %aPBe2k3ugtjBr4rrsU1…



Commit f1621d686b6c41ae4157667b3f76735cfbbc60e5

Make version attribute a plain String

Fixes #106
Matt Wildig committed on 1/9/2015, 1:53:52 PM
Parent: b82c7140eb4ecedc20ab3a7c0d0801667d1907b3

Files changed

lib/bcrypt/password.rbchanged
spec/bcrypt/password_spec.rbchanged
lib/bcrypt/password.rbView
@@ -79,9 +79,9 @@
7979 #
8080 # Splits +h+ into version, cost, salt, and hash and returns them in that order.
8181 def split_hash(h)
8282 _, 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
8484 end
8585 end
8686
8787 end
spec/bcrypt/password_spec.rbView
@@ -74,8 +74,9 @@
7474
7575 specify "should read the version, cost, salt, and hash" do
7676 password = BCrypt::Password.new(@hash)
7777 expect(password.version).to eql("2a")
78+ expect(password.version.class).to eq String
7879 expect(password.cost).to equal(5)
7980 expect(password.salt).to eql("$2a$05$CCCCCCCCCCCCCCCCCCCCC.")
8081 expect(password.salt.class).to eq String
8182 expect(password.checksum).to eq("E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW")

Built with git-ssb-web