Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions ed25519.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

import hashlib


__version__ = "1.0.dev0"


Expand Down Expand Up @@ -118,7 +117,7 @@ def edwards_add(P, Q):
def edwards_double(P):
# This is formula sequence 'dbl-2008-hwcd' from
# http://www.hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html
(x1, y1, z1, t1) = P
(x1, y1, z1, _) = P

a = x1 * x1 % q
b = y1 * y1 % q
Expand Down Expand Up @@ -183,7 +182,7 @@ def encodeint(y):


def encodepoint(P):
(x, y, z, t) = P
(x, y, z, _) = P
zi = inv(z)
x = (x * zi) % q
y = (y * zi) % q
Expand Down Expand Up @@ -238,11 +237,11 @@ def isoncurve(P):


def decodeint(s):
return sum(2**i * bit(s, i) for i in range(0, b))
return sum(2**i * bit(s, i) for i in range(b))


def decodepoint(s):
y = sum(2**i * bit(s, i) for i in range(0, b - 1))
y = sum(2**i * bit(s, i) for i in range(b - 1))
x = xrecover(y)
if x & 1 != bit(s, b - 1):
x = q - x
Expand Down Expand Up @@ -274,8 +273,8 @@ def checkvalid(s, m, pk):
S = decodeint(s[b // 8 : b // 4])
h = Hint(encodepoint(R) + pk + m)

(x1, y1, z1, t1) = P = scalarmult_B(S)
(x2, y2, z2, t2) = Q = edwards_add(R, scalarmult(A, h))
(x1, y1, z1, _) = P = scalarmult_B(S)
(x2, y2, z2, _) = Q = edwards_add(R, scalarmult(A, h))

if (
not isoncurve(P)
Expand Down
1 change: 0 additions & 1 deletion science.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import ed25519


seed = os.urandom(32)

data = b"The quick brown fox jumps over the lazy dog"
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import ed25519


setup(
name="ed25519.py",
version=ed25519.__version__,
Expand Down
2 changes: 1 addition & 1 deletion test_ed25519.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,6 @@ def test_checkparams():
assert pow(ed25519.d, (ed25519.q - 1) // 2, ed25519.q) == ed25519.q - 1
assert pow(ed25519.I, 2, ed25519.q) == ed25519.q - 1
assert ed25519.isoncurve(ed25519.B)
x, y, z, t = P = ed25519.scalarmult(ed25519.B, ed25519.l)
x, y, z, _ = P = ed25519.scalarmult(ed25519.B, ed25519.l)
assert ed25519.isoncurve(P)
assert (x, y) == (0, z)