Golang crypto/subtle.ConstantTimeEq() function example
package crypto/subtle
ConstantTimeEq returns 1 if x == y and 0 otherwise.
Golang crypto/subtle.ConstantTimeEq() function usage example
package main
import (
"fmt"
"crypto/subtle"
)
func main() {
x := int32(1)
y := int32(2)
z := int32(1)
n := subtle.ConstantTimeEq(x,y)
fmt.Printf("n : %d \n", n)
nn := subtle.ConstantTimeEq(x,z)
fmt.Printf("nn : %d \n", nn)
}
Output :
n : 0
nn : 1
Reference :
Advertisement
Something interesting
Tutorials
+7k Golang : How to call function inside template with template.FuncMap
+12.2k Linux : How to install driver for 600Mbps Dual Band Wifi USB Adapter
+11.6k Golang : Surveillance with web camera and OpenCV
+6.7k Golang : Output or print out JSON stream/encoded data
+6.3k Apt-get to install and uninstall Golang
+20.8k Golang : Convert date string to variants of time.Time type examples
+9.7k Golang : Eroding and dilating image with OpenCV example
+80.6k Golang : How to return HTTP status code?
+6.5k Unix/Linux : How to get own IP address ?
+9.5k Golang : Extract or copy items from map based on value
+7.5k Golang : Gorrila set route name and get the current route name