Remove extraneous space

This commit is contained in:
Juhani Krekelä 2020-06-25 12:37:37 +03:00
parent cd6544ce67
commit d4956a2fd6
1 changed files with 1 additions and 1 deletions

View File

@ -9,7 +9,7 @@ def x25519(k,u):
for t in range(254,-1,-1):kt=(k>>t)&1;s^=kt;x2,x3=cs(s,x2,x3);z2,z3=cs(s,z2,z3);s=kt;A=(x2+z2)%p;AA=pow(A,2,p);B=(x2-z2)%p;BB=pow(B,2,p);E=(AA-BB)%p;C=(x3+z3)%p;D=(x3-z3)%p;DA=(D*A)%p;CB=(C*B)%p;x3=pow((DA+CB)%p,2,p);z3=(x1*pow((DA-CB)%p,2,p))%p;x2=(AA*BB)%p;z2=(E*((AA+(121665*E)%p)%p)%p)%p
x2,x3=cs(s,x2,x3);z2,z3=cs(s,z2,z3);u=(x2*pow(z2,p-2,p))%p;return bytes(u>>i&255 for i in range(0,255,8))
pubkey=lambda sk:x25519(sk,b'\x09'+b'\x00'*31)
def ecdh(pk, sk):
def ecdh(pk,sk):
k=x25519(sk,pk);o=0
for i in k:o|=i
if o==0:raise ValueError