package plain import ( "crypto/subtle" "forge.cadoles.com/arcad/edge/pkg/module/auth/http/passwd" ) const ( Algo passwd.Algo = "plain" ) func init() { passwd.Register(Algo, &Hasher{}) } type Hasher struct{} // Hash implements passwd.Hasher func (*Hasher) Hash(plaintext string) (string, error) { return plaintext, nil } // Match implements passwd.Hasher. func (*Hasher) Match(plaintext string, hash string) (bool, error) { matches := subtle.ConstantTimeCompare([]byte(plaintext), []byte(hash)) == 1 return matches, nil } var _ passwd.Hasher = &Hasher{}