Functions
inline fn secureZero(comptime T: type, s: []T) void
Sets a slice to zeroes. Prevents the store from being optimized out.
fn timingSafeAdd(comptime T: type, a: []const T, b: []const T, result: []T, endian: Endian) bool
Add two integers serialized as arrays of the same size, in constant time. The r…
Add two integers serialized as arrays of the same size, in constant time. The result is stored into
result
, andtrue
is returned if an overflow occurred.fn timingSafeCompare(comptime T: type, a: []const T, b: []const T, endian: Endian) Order
Compare two integers serialized as arrays of the same size, in constant time. R…
Compare two integers serialized as arrays of the same size, in constant time. Returns .lt if a<b, .gt if a>b and .eq if a=b
fn timingSafeEql(comptime T: type, a: T, b: T) bool
Compares two arrays in constant time (for a given length) and returns whether th…
Compares two arrays in constant time (for a given length) and returns whether they are equal. This function was designed to compare short cryptographic secrets (MACs, signatures). For all other applications, use mem.eql() instead.
fn timingSafeSub(comptime T: type, a: []const T, b: []const T, result: []T, endian: Endian) bool
Subtract two integers serialized as arrays of the same size, in constant time. …
Subtract two integers serialized as arrays of the same size, in constant time. The result is stored into
result
, andtrue
is returned if an underflow occurred.