Skip to content

Commit 18f9bb1

Browse files
committed
🙃 Replace Field.div() with Field.mul() (faster)
1 parent 298c5b4 commit 18f9bb1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

‎mina/humanIDv1.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ const authenticate = (humanIDv1: Field, sigs: Signatures) => {
2424

2525
const EmptyRoot = Field(0x21afce36daa1a2d67391072035f4555a85aea7197e5830b128f121aa382770cdn);
2626

27+
const Inverse2Exp32 = Field(0x3fffffffc00000000000000000000000224698fbe706601f8fe037d166d2cf14n);
28+
2729
const requireConsistent = (humanIDv1: Field, truncatedHumanIDv1: Field) => {
28-
humanIDv1.sub(truncatedHumanIDv1).div(1n << 32n).assertLessThan(
30+
humanIDv1.sub(truncatedHumanIDv1).mul(Inverse2Exp32).assertLessThan(
2931
(1n << 222n) + 0x224698fc094cf91b992d30edn,
3032
"HumanID does not match the witness"
3133
);

0 commit comments

Comments
 (0)