Standard library / crypto/subtle
crypto/subtle.ConstantTimeLessOrEq()
Compare nonnegative integers no larger than 2^31-1. Outside this domain behavior is undefined. Functional tests are not timing or side-channel audits. Expected stdout: '1 0\n'.
Formal Syntax & Structure
go syntaxgo
func ConstantTimeLessOrEq(x, y int) intParameters & Attributes
| Name | Type | Description |
|---|---|---|
| x | int | First operand. |
| y | int | Second operand. |
Return Value
int
1 for true and 0 for false.
Working Example
Example Snippetgo
package main
import ( "crypto/subtle" "fmt")
func main() { fmt.Println(subtle.ConstantTimeLessOrEq(7, 7), subtle.ConstantTimeLessOrEq(8, 7)) }