3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-15 00:19:29 +01:00

Merge pull request #2112 from slingamn/testvector

include a fixed test vector in password tests
This commit is contained in:
Shivaram Lingamneni 2023-12-20 23:30:40 -05:00 committed by GitHub
commit cc1c491afe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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) { func TestLongPassphrases(t *testing.T) {
longPassphrase := make([]byte, 168) longPassphrase := make([]byte, 168)
for i := range longPassphrase { for i := range longPassphrase {