def double

bend-collections-laws-crypto@1.0.0.0 · src/crypto/ed25519/point.bend:80

import bend-collections-laws-crypto@1.0.0.0/src/crypto/ed25519/point.bend as Point
import Base
import bend-collections-laws-crypto@1.0.0.0/src/crypto/curve25519/field.bend as F

80# RFC 8032 5.1.4, doubling
81def double(p: Pt) -> Pt:
82  match p:
83    case Pt{+x1, +y1, +z1, t1}:
84      +a = F.sq(x1)
85      +b = F.sq(y1)
86      +zz = F.sq(z1)
87      +cc = F.add(zz, zz)
88      +h = F.add(a, b)
89      +e = F.sub(h, F.sq(F.add(x1, y1)))
90      +g = F.sub(a, b)
91      +f = F.add(cc, g)
92      Pt{F.mul(e, f), F.mul(g, h), F.mul(f, g), F.mul(e, h)}

Uses (5)

Used by (3)