Skip to content

Commit f1621d6

Browse files
committed
Make version attribute a plain String
Fixes #106
1 parent b82c714 commit f1621d6

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

‎lib/bcrypt/password.rb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def valid_hash?(h)
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

‎spec/bcrypt/password_spec.rb‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
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

0 commit comments

Comments
 (0)