forked from mtusi2026/mtusi2026lab7
feat: secure messenger ingress and rate-limit logins
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package services
|
||||
|
||||
import "testing"
|
||||
|
||||
func BenchmarkPasswordVerification(b *testing.B) {
|
||||
const password = "synthetic-benchmark-password"
|
||||
hash, err := HashPassword(password)
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
b.ReportAllocs()
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
ok, err := VerifyPassword(password, hash)
|
||||
if err != nil || !ok {
|
||||
b.Fatalf("verification failed: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user