def pow_ones

bend-collections@1.0.0.0 · src/crypto/curve25519/field.bend:215

import bend-collections@1.0.0.0/src/crypto/curve25519/field.bend as Field
import Base

215# acc^(2^n) * x^(2^n - 1): n steps of acc = acc^2 * x
216def pow_ones(+x: List<&2, U32>, n: Nat, acc: List<&2, U32>) -> List<&2, U32>:
217  match x:
218    case Nil{}:
219      acc
220    case Con{h, t}:
221      match n:
222        case 0n:
223          acc
224        case 1n+m:
225          pow_ones(x, m, mul(sq(acc), x))

Uses (5)

Used by (3)