Skip to content

Commit

Permalink
build(deps): drop curve25519-donna and ed25519 from deps
Browse files Browse the repository at this point in the history
[no changelog]
  • Loading branch information
prusnak authored and matejcik committed Apr 17, 2024
1 parent 90afd9c commit caa3c03
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 32 deletions.
18 changes: 9 additions & 9 deletions crypto/tests/test_curves.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import os
import random

import curve25519
import ecdsa
import pytest
from cryptography.hazmat.primitives.asymmetric.x25519 import X25519PrivateKey


def bytes2num(s):
Expand Down Expand Up @@ -344,28 +344,28 @@ def test_validate_pubkey_direct(point):
def test_curve25519(r):
sec1 = bytes(bytearray(r.randbytes(32)))
sec2 = bytes(bytearray(r.randbytes(32)))
pub1 = curve25519.Private(sec1).get_public()
pub2 = curve25519.Private(sec2).get_public()
pub1 = X25519PrivateKey.from_private_bytes(sec1).public_key()
pub2 = X25519PrivateKey.from_private_bytes(sec2).public_key()

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

shared1 = curve25519.Private(sec2).get_shared_key(pub1, hashfunc=lambda x: x)
shared2 = curve25519.Private(sec1).get_shared_key(pub2, hashfunc=lambda x: x)
shared1 = X25519PrivateKey.from_private_bytes(sec2).exchange(pub1)
shared2 = X25519PrivateKey.from_private_bytes(sec1).exchange(pub2)
assert shared1 == shared2
assert bytearray(session1) == shared1
assert bytearray(session2) == shared2


def test_curve25519_pubkey(r):
sec = bytes(bytearray(r.randbytes(32)))
pub = curve25519.Private(sec).get_public()
pub = X25519PrivateKey.from_private_bytes(sec).public_key()
res = r.randbytes(32)
lib.curve25519_scalarmult_basepoint(res, sec)
assert bytearray(res) == pub.public
assert bytearray(res) == pub.public_bytes_raw()


def test_curve25519_scalarmult_from_gpg(r):
Expand Down
22 changes: 1 addition & 21 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,12 @@ graphviz = "*"

## cointool
click = "^8"
ed25519 = "^1.4"
requests = "^2.31"
termcolor = "*"
Pillow = ">=10.0.1"

# crypto
ecdsa = "^0.16"
curve25519-donna = "*"
pyasn1 = "*"

# legacy
Expand Down

0 comments on commit caa3c03

Please sign in to comment.