Skip to content
This repository has been archived by the owner on Nov 16, 2021. It is now read-only.

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
prusnak committed Mar 30, 2017
1 parent c200ce1 commit 323d6b0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test_curves.py
Expand Up @@ -409,9 +409,9 @@ def test_curve25519(r):
pub2 = curve25519.Private(sec2).get_public()

session1 = r.randbytes(32)
lib.curve25519_donna(session1, sec2, pub1.public)
lib.curve25519_scalarmult(session1, sec2, pub1.public)
session2 = r.randbytes(32)
lib.curve25519_donna(session2, sec1, pub2.public)
lib.curve25519_scalarmult(session2, sec1, pub2.public)
assert bytearray(session1) == bytearray(session2)

shared1 = curve25519.Private(sec2).get_shared_key(pub1, hashfunc=lambda x: x)
Expand All @@ -425,14 +425,14 @@ def test_curve25519_pubkey(r):
sec = bytes(bytearray(r.randbytes(32)))
pub = curve25519.Private(sec).get_public()
res = r.randbytes(32)
lib.curve25519_donna_basepoint(res, sec)
lib.curve25519_scalarmult_basepoint(res, sec)
assert bytearray(res) == pub.public


def test_curve25519_scalarmult_from_gpg(r):
sec = binascii.unhexlify('4a1e76f133afb29dbc7860bcbc16d0e829009cc15c2f81ed26de1179b1d9c938')
pub = binascii.unhexlify('5d6fc75c016e85b17f54e0128a216d5f9229f25bac1ec85cecab8daf48621b31')
res = r.randbytes(32)
lib.curve25519_donna(res, sec[::-1], pub[::-1])
lib.curve25519_scalarmult(res, sec[::-1], pub[::-1])
expected = 'a93dbdb23e5c99da743e203bd391af79f2b83fb8d0fd6ec813371c71f08f2d4d'
assert binascii.hexlify(bytearray(res)) == expected

0 comments on commit 323d6b0

Please sign in to comment.