diff --git a/spec/std/crypto/bcrypt/password_spec.cr b/spec/std/crypto/bcrypt/password_spec.cr index 64fe68ad8f23..269ab140c421 100644 --- a/spec/std/crypto/bcrypt/password_spec.cr +++ b/spec/std/crypto/bcrypt/password_spec.cr @@ -55,6 +55,7 @@ describe "Crypto::Bcrypt::Password" do password2 = Crypto::Bcrypt::Password.new("$2$04$ZsHrsVlj.dsmn74Az1rjmeE/21nYRC0vB5LPjG7ySBfi6lRaO/P22") password2a = Crypto::Bcrypt::Password.new("$2a$04$ZsHrsVlj.dsmn74Az1rjmeE/21nYRC0vB5LPjG7ySBfi6lRaO/P22") password2b = Crypto::Bcrypt::Password.new("$2b$04$ZsHrsVlj.dsmn74Az1rjmeE/21nYRC0vB5LPjG7ySBfi6lRaO/P22") + password2y = Crypto::Bcrypt::Password.new("$2y$04$ZsHrsVlj.dsmn74Az1rjmeE/21nYRC0vB5LPjG7ySBfi6lRaO/P22") it "verifies password is incorrect" do (password.verify "wrong").should be_false @@ -73,5 +74,8 @@ describe "Crypto::Bcrypt::Password" do it "verifies password version 2b is correct (#11584)" do (password2b.verify "secret").should be_true end + it "verifies password version 2y is correct" do + (password2y.verify "secret").should be_true + end end end diff --git a/src/crypto/bcrypt/password.cr b/src/crypto/bcrypt/password.cr index 80ed27a5edc6..234ac5c1918a 100644 --- a/src/crypto/bcrypt/password.cr +++ b/src/crypto/bcrypt/password.cr @@ -15,7 +15,7 @@ require "../subtle" # # See `Crypto::Bcrypt` for hints to select the cost when generating hashes. class Crypto::Bcrypt::Password - private SUPPORTED_VERSIONS = ["2", "2a", "2b"] + private SUPPORTED_VERSIONS = ["2", "2a", "2b", "2y"] # Hashes a password. #