Closed chancehudson closed 4 months ago
BFieldElement
s are internally represented in Montgomery form. You see the Montgomery form with debug formatting. However, BFieldElement
also implements Display
, which produces a string which hides the Montgomery cofactor. Alternatively, you can use .value()
which divides out the Montgomery factor before returning the u64
you would expect.
Ah gotcha, thanks!
Hi, I've run into a strange thing. I'm proving the following program:
I get the following:
Note that the output is a single element
5742371273415
which== 1337 * (2^32-1)
. When I test outputing a larger value like2^50 + 1337
the output is((2^50 + 1337)*(2^32-1)) % (2^64 - 2^32 + 1) = 5742371011271
. I think it's possible to generally unwrap the output by multiplying by the modular inverse of2^32 - 1
.I want to confirm if this is intended behavior, or if I'm improperly handling output.
Thanks