Skip to content

Commit

Permalink
Make version attribute a plain String
Browse files Browse the repository at this point in the history
Fixes #106
  • Loading branch information
mattwildig committed Jan 9, 2015
1 parent b82c714 commit f1621d6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/bcrypt/password.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def valid_hash?(h)
# Splits +h+ into version, cost, salt, and hash and returns them in that order.
def split_hash(h)
_, v, c, mash = h.split('$')
return v, c.to_i, h[0, 29].to_str, mash[-31, 31].to_str
return v.to_str, c.to_i, h[0, 29].to_str, mash[-31, 31].to_str
end
end

Expand Down
1 change: 1 addition & 0 deletions spec/bcrypt/password_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
specify "should read the version, cost, salt, and hash" do
password = BCrypt::Password.new(@hash)
expect(password.version).to eql("2a")
expect(password.version.class).to eq String
expect(password.cost).to equal(5)
expect(password.salt).to eql("$2a$05$CCCCCCCCCCCCCCCCCCCCC.")
expect(password.salt.class).to eq String
Expand Down

0 comments on commit f1621d6

Please sign in to comment.