Implement lab2 PostgreSQL messenger, sessions, SQL research and defense guide

This commit is contained in:
2026-10-02 12:49:09 +03:00
parent 65003b6119
commit 6fe56ec642
43 changed files with 12869 additions and 33 deletions
+20
View File
@@ -0,0 +1,20 @@
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")
}
}