Skip to content

Commit

Permalink
suggested renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
hecmas committed Apr 27, 2024
1 parent 1612eea commit 9dfcfd4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions main/ecrecover/FPSECP256K1/sqrtFpSecp256k1.zkasm
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

VAR GLOBAL _C
VAR GLOBAL _input

; RESOURCES:
; with sqrt: 1 arith + 1 binary + 7 steps
; without sqrt: 1 binary + 4 steps
; TOTAL (worst case): 1 arith + 1 binary + 7 steps

sqrtFpSecp256k1:
C => _C
C => _input

; start by free-inputing the square root of the input C
; taking the positive one if A = 1, and the negative one if A = 0
Expand All @@ -29,14 +29,14 @@ sqrtFpSecp256k1:
; b) A contains an alias, it's a MAP. 1 is returned in C. In this case, the proof cannot
; be generated because we check in assertNQRFpSecp256k1 if the root actually exists.
%SECP256K1_P => B
$ :LT, JMPNC(sqrtFpSecp256k1_NoRoot)
$ :LT, JMPNC(sqrtFpSecp256k1_NoRoot)
; From here, A,C < SECP256K1_P, which means that the root exists and it's alias-free

; √C·√C + 0 = C (mod SECP256K1_P)
A => B
0 => C
%SECP256K1_P => D
${(A*B) % D} :ARITH_MOD, MLOAD(_C), RETURN
${(A*B) % D} :ARITH_MOD, MLOAD(_input), RETURN

sqrtFpSecp256k1_NoRoot:
1 => C :RETURN
1 => C :RETURN

0 comments on commit 9dfcfd4

Please sign in to comment.