Bn254 Field Library
Noir provides a module in standard library with some optimized functions for bn254 Fr in std::field::bn254
.
decompose
fn decompose(x: Field) -> (Field, Field) {}
Decomposes a single field into two fields, low and high. The low field contains the lower 16 bytes of the input field and the high field contains the upper 16 bytes of the input field. Both field results are range checked to 128 bits.
assert_gt
fn assert_gt(a: Field, b: Field) {}
Asserts that a > b. This will generate less constraints than using assert(gt(a, b))
.
assert_lt
fn assert_lt(a: Field, b: Field) {}
Asserts that a < b. This will generate less constraints than using assert(lt(a, b))
.
gt
fn gt(a: Field, b: Field) -> bool {}
Returns true if a > b.