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
+9.1k Golang : Simple histogram example
+10.1k Golang : Find and replace data in all files recursively
+29.5k Golang : How to create new XML file ?
+8k Golang : Sort words with first uppercase letter
+4.5k Java : Generate multiplication table example
+3.6k Java : Get FX sentiment from website example
+20k Golang : How to run your code only once with sync.Once object
+5.5k Clean up Visual Studio For Mac installation failed disk full problem
+7.1k Golang : Get environment variable
+12k Golang : Decompress zlib file example
+13.2k Golang : Convert(cast) int to int64