21 lines
522 B
Go
21 lines
522 B
Go
package messenger
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestPasswordFullUnicodeRange(t *testing.T) {
|
|
password := strings.Repeat("🙂", 128) // 512 bytes: exceeds bcrypt's 72-byte limit.
|
|
hash := hashPassword(password)
|
|
if !verifyPassword(password, hash) || verifyPassword(password+"x", hash) {
|
|
t.Fatal("password mismatch")
|
|
}
|
|
if hash == hashPassword(password) {
|
|
t.Fatal("salt reused")
|
|
}
|
|
if verifyPassword(password, "$argon2id$v=19$m=999999999,t=3,p=2$abc$def") {
|
|
t.Fatal("unbounded parameters accepted")
|
|
}
|
|
}
|