fix: address review comments
CI / verify (pull_request) Successful in 4m16s

This commit is contained in:
2026-09-25 11:46:02 +03:00
parent 09779a53ae
commit 6d5ac9e81d
26 changed files with 683 additions and 666 deletions
+13 -2
View File
@@ -3,7 +3,10 @@ package password
import "testing"
func TestHasher(t *testing.T) {
hasher := Hasher{}
hasher, err := New(testConfig())
if err != nil {
t.Fatalf("New() error = %v", err)
}
hash, err := hasher.Hash("T3st-password-123")
if err != nil {
t.Fatalf("Hash() error = %v", err)
@@ -27,7 +30,15 @@ func TestHasher(t *testing.T) {
}
func TestVerifyRejectsMalformedHash(t *testing.T) {
if _, err := (Hasher{}).Verify("password", "invalid"); err == nil {
hasher, err := New(testConfig())
if err != nil {
t.Fatalf("New() error = %v", err)
}
if _, err := hasher.Verify("password", "invalid"); err == nil {
t.Fatal("Verify() error = nil for malformed hash")
}
}
func testConfig() Config {
return Config{MemoryKiB: 8 * 1024, Iterations: 1, Parallelism: 1, SaltLength: 16, KeyLength: 32}
}