fn Uint(comptime max_bits: comptime_int) type

An unsigned big integer with a fixed maximum size (max_bits), suitable for cryptographic operations. Unless side-channels mitigations are explicitly disabled, operations are designed to be constant-time.

Parameters

max_bits: comptime_int,

Fields

limbs: Limbs,

Functions

fn addWithOverflow(x: *Self, y: Self) u1

Adds y to x, and returns true if the operation overflowed.

fn compare(x: Self, y: Self) math.Order

Compares two integers.

fn eql(x: Self, y: Self) bool

Returns true if both integers are equal.

fn fromBytes(bytes: []const u8, comptime endian: builtin.Endian) OverflowError!Self

Creates a new big integer from a byte array.

fn fromPrimitive(comptime T: type, x_: T) OverflowError!Self

Creates a new big integer from a primitive type. This function may not run in c…

Creates a new big integer from a primitive type. This function may not run in constant time.

fn isOdd(x: Self) bool

Returns true if the integer is odd.

fn isZero(x: Self) bool

Returns true if the integer is zero.

fn subWithOverflow(x: *Self, y: Self) u1

Subtracts y from x, and returns true if the operation overflowed.

fn toBytes(self: Self, bytes: []u8, comptime endian: builtin.Endian) OverflowError!void

Encodes a big integer into a byte array.

fn toPrimitive(self: Self, comptime T: type) OverflowError!T

Converts a big integer to a primitive type. This function may not run in consta…

Converts a big integer to a primitive type. This function may not run in constant time.

Values

encoded_bytes
type

Number of bytes required to serialize an integer.

zero
type

The zero integer.