From 8d80cb52e6e01fe8d41e8e6d2df92eddaa2ace20 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Wed, 20 Dec 2023 23:28:55 -0500 Subject: [PATCH] include a fixed test vector in password tests --- irc/passwd/bcrypt_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/irc/passwd/bcrypt_test.go b/irc/passwd/bcrypt_test.go index 8849ab7d..276859aa 100644 --- a/irc/passwd/bcrypt_test.go +++ b/irc/passwd/bcrypt_test.go @@ -22,6 +22,16 @@ func TestBasic(t *testing.T) { } } +func TestVector(t *testing.T) { + // sanity check for persisted hashes + if CompareHashAndPassword( + []byte("$2a$12$sJokyLJ5px3Nb51DEDhsQ.wh8nfwEYuMbVYrpqO5v9Ylyj0YyVWj."), + []byte("this is my passphrase"), + ) != nil { + t.Errorf("hash comparison failed unexpectedly") + } +} + func TestLongPassphrases(t *testing.T) { longPassphrase := make([]byte, 168) for i := range longPassphrase {