package api import ( "log" "golang.org/x/crypto/bcrypt" ) func EncryptPassword(password string) string { hash, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.MinCost) if err != nil { log.Println("Warning: Failed to hash password, fallback to plaintext password") return password } return string(hash) } func ComparePassword(hashedPassword string, plainTextPassword string) error { err := bcrypt.CompareHashAndPassword([]byte(hashedPassword), []byte(plainTextPassword)) return err }