chore: upgrade dependencies and secure passwords

This commit is contained in:
2026-08-10 12:53:23 +08:00
parent 1a1fa521c0
commit 581a503883
53 changed files with 298 additions and 143 deletions

View File

@@ -0,0 +1,12 @@
package password
import "golang.org/x/crypto/bcrypt"
func Hash(plain string) (string, error) {
hash, err := bcrypt.GenerateFromPassword([]byte(plain), bcrypt.DefaultCost)
return string(hash), err
}
func Verify(hash, plain string) bool {
return bcrypt.CompareHashAndPassword([]byte(hash), []byte(plain)) == nil
}