std.crypto.ff.DivisionByZeroError
- Kind
- error set
- Module
std.crypto.ff
Source: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
The entries of std.crypto.ff in the Zig reference. This page has 50 cards.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
The set of all possible errors `std.crypto.ff` functions can return.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
Invalid field element for the given modulus.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
Invalid modulus.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn Modulus(comptime max_bits: comptime_int) type
A modulus, defining a finite field.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn add(self: Self, x: Fe, y: Fe) Fe
Adds two field elements (mod m).
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn bits(self: Self) usize
Actual size of the modulus, in bits.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn encodedLen(self: Self) usize
Returns the encoded length, in bytes.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
A field element, representing a value within the field defined by this modulus.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn fromBytes(bytes: []const u8, comptime endian: Endian) (InvalidModulusError || OverflowError)!Self
Creates a new modulus from a byte string.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn fromMontgomery(self: Self, x: *Fe) RepresentationError!void
Takes a field element out of the Montgomery form.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn fromPrimitive(comptime T: type, x: T) (InvalidModulusError || OverflowError)!Self
Creates a new modulus from a primitive value.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn fromUint(v_: FeUint) InvalidModulusError!Self
Creates a new modulus from a `Uint` value.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn mul(self: Self, x: Fe, y: Fe) Fe
Multiplies two field elements.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn one(self: Self) Fe
Returns the element `1`.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn pow(self: Self, x: Fe, e: Fe) (NullExponentError || RepresentationError)!Fe
Returns x^e (mod m) in constant time.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn powPublic(self: Self, x: Fe, e: Fe) (NullExponentError || RepresentationError)!Fe
Returns x^e (mod m), assuming that the exponent is public.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn powWithEncodedExponent(self: Self, x: Fe, e: []const u8, endian: Endian) NullExponentError!Fe
Returns x^e (mod m), with the exponent provided as a byte string.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn powWithEncodedPublicExponent(self: Self, x: Fe, e: []const u8, endian: Endian) NullExponentError!Fe
Returns x^e (mod m), the exponent being public and provided as a byte string.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn reduce(self: Self, x: anytype) Fe
Reduces an arbitrary `Uint`, converting it to a field element.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn rejectNonCanonical(self: Self, fe: Fe) error
Rejects field elements that are not in the canonical form.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn sq(self: Self, x: Fe) Fe
Squares a field element.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn sub(self: Self, x: Fe, y: Fe) Fe
Subtracts two field elements (mod m).
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn toBytes(self: Self, bytes: []u8, comptime endian: Endian) OverflowError!void
Serializes the modulus to a byte string.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn toMontgomery(self: Self, x: *Fe) RepresentationError!void
Converts a field element to the Montgomery form.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn toUint(self: Self) FeUint
Returns the modulus as an integer.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
Exponentiation with a null exponent.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
Value is too large for the destination.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
Invalid representation (Montgomery vs non-Montgomery domain.).
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn Uint(comptime max_bits: comptime_int) type
An unsigned big integer with a fixed maximum size (`max_bits`), suitable for cryptographic operations.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn addWithOverflow(x: *Self, y: Self) u1
Adds `y` to `x`, wrapping at the larger active width.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn bitLenPublic(x: Self) usize
Returns the bit length, or 0 for zero.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn compare(x: Self, y: Self) math.Order
Compares two integers.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn divRemPublic(x: *Self, divisor: usize) DivisionByZeroError!usize
Divides by `divisor` in place and returns the remainder.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
Number of bytes required to serialize an integer.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn eql(x: Self, y: Self) bool
Returns `true` if both integers are equal.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn fromBytes(bytes: []const u8, comptime endian: Endian) OverflowError!Self
Creates a new big integer from a byte array.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn fromPrimitive(comptime T: type, init_value: T) OverflowError!Self
Creates a new big integer from a primitive type.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn gcdPublic(x: Self, y: Self) DivisionByZeroError!Self
Returns the greatest common divisor, with gcd(x, 0) = x.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn isOdd(x: Self) bool
Returns `true` if the integer is odd.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn isOne(x: Self) bool
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn isZero(x: Self) bool
Returns `true` if the integer is zero.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn mulAddWithOverflow(acc: *Self, x: Self, y: Self) u1
Adds the product of `x` and `y` to `acc`, wrapping at the active width.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn shiftRightPublic(x: *Self, shift: usize) void
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn subWithOverflow(x: *Self, y: Self) u1
Subtracts `y` from `x`, wrapping at the larger active width.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn toBytes(self: Self, bytes: []u8, comptime endian: Endian) OverflowError!void
Encodes a big integer into a byte array.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn toPrimitive(self: Self, comptime T: type) OverflowError!T
Converts a big integer to a primitive type.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn trailingZeroBitsPublic(x: Self) usize
Returns the number of trailing zero bits, or the active width for zero.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
The zero integer.
std.crypto.ffSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.