Constant-time-shaped helpers; the backend does not guarantee timing.
constant_time_compare
XuAPI
pubfn constant_time_compare(x &string, y &string) int
Purpose
Helpers aligned with `crypto/subtle`. XU-CT-CONTRACT v1: constant_time_compare, constant_time_byte_eq, constant_time_eq and constant_time_select have a fixed iteration count and branchless result selection for caller-provided public shapes. A compare length mismatch is public-shape validation and may return early. xor_bytes is not in the contracted set. This contract does not make AES, big.Int, RSA, ECDSA/ECDH or other consumers constant-time. XU-CT-CLASS: constant-time-contracted
Parameters
x&string
value (borrowed; caller keeps it; type &string)
y&string
value (borrowed; caller keeps it; type &string)
Returns
int — a value of this type
constant_time_byte_eq
XuAPI
pubfn constant_time_byte_eq(x int, y int) int
Purpose
Constant time byte eq.
Parameters
xint
value (int)
yint
value (int)
Returns
int — a value of this type
constant_time_eq
XuAPI
pubfn constant_time_eq(x int, y int) int
Purpose
Constant time eq.
Parameters
xint
value (int)
yint
value (int)
Returns
int — a value of this type
constant_time_select
XuAPI
pubfn constant_time_select(v int, x int, y int) int