Browse Source

optimize s^2 -> s2, thanks Fabio Scotoni

master
Mike Hamburg 4 years ago
parent
commit
ff5d289935
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      _aux/ristretto/ristretto.sage

+ 4
- 4
_aux/ristretto/ristretto.sage View File

@@ -311,7 +311,7 @@ class RistrettoPoint(QuotientEdwardsPoint):


class Decaf_1_1_Point(QuotientEdwardsPoint):
"""Like current decaf but tweaked for simplicity"""
"""Like current decaf but tweaked for compatibility with Ristretto"""
def encodeSpec(self):
"""Unoptimized specification for encoding"""
a,d = self.a,self.d
@@ -486,7 +486,7 @@ class Decaf_1_1_Point(QuotientEdwardsPoint):
altx = 2*s*isr*den*cls.isoMagic
if negative(altx): isr = -isr
x = 2*s *isr^2*den*num
y = (1-a*s^2) * isr*den
y = (1-a*s2) * isr*den
if cls.cofactor==8 and (negative(x*y*cls.isoMagic) or y==0):
raise InvalidEncodingException("x*y is invalid: %d, %d" % (x,y))
@@ -875,5 +875,5 @@ testDoubleAndEncode(TwistedEd448GoldilocksPoint,100)
#testElligator(IsoEd448Point,100)
#testElligator(Ed448GoldilocksPoint,100)
#testElligator(TwistedEd448GoldilocksPoint,100)
#gangtest([IsoEd448Point,TwistedEd448GoldilocksPoint,Ed448GoldilocksPoint],100)
#gangtest([Ed25519Point,IsoEd25519Point],100)
gangtest([IsoEd448Point,TwistedEd448GoldilocksPoint,Ed448GoldilocksPoint],100)
gangtest([Ed25519Point,IsoEd25519Point],100)

Loading…
Cancel
Save