git.sr.ht/~pingoo/stdx@v0.0.0-20240218134121-094174641f6e/crypto/compare.go (about) 1 package crypto 2 3 import ( 4 "crypto/subtle" 5 ) 6 7 // ConstantTimeCompare returns true if the 2 buffer are equals and false otherwise 8 func ConstantTimeCompare(x, y []byte) bool { 9 res := subtle.ConstantTimeCompare(x, y) 10 return res == 1 11 }