Browse Source

Merge pull request #2112 from slingamn/testvector

include a fixed test vector in password tests
tags/v2.13.0-rc1
Shivaram Lingamneni 4 months ago
parent
commit
cc1c491afe
No account linked to committer's email address
1 changed files with 10 additions and 0 deletions
  1. 10
    0
      irc/passwd/bcrypt_test.go

+ 10
- 0
irc/passwd/bcrypt_test.go View File

@@ -22,6 +22,16 @@ func TestBasic(t *testing.T) {
22 22
 	}
23 23
 }
24 24
 
25
+func TestVector(t *testing.T) {
26
+	// sanity check for persisted hashes
27
+	if CompareHashAndPassword(
28
+		[]byte("$2a$12$sJokyLJ5px3Nb51DEDhsQ.wh8nfwEYuMbVYrpqO5v9Ylyj0YyVWj."),
29
+		[]byte("this is my passphrase"),
30
+	) != nil {
31
+		t.Errorf("hash comparison failed unexpectedly")
32
+	}
33
+}
34
+
25 35
 func TestLongPassphrases(t *testing.T) {
26 36
 	longPassphrase := make([]byte, 168)
27 37
 	for i := range longPassphrase {

Loading…
Cancel
Save