fix: point multiplication (#115)

This commit is contained in:
Vlad Stan 2025-11-13 12:10:40 +02:00 committed by GitHub
parent 9c00adbf2d
commit 17d13dbe6b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 15 additions and 4 deletions

View file

@ -10,7 +10,11 @@ from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
def get_shared_secret(privkey: str, pubkey: str):
pk = coincurve.PublicKey(bytes.fromhex("02" + pubkey))
sk = coincurve.PrivateKey(bytes.fromhex(privkey))
return sk.ecdh(pk.format())
shared_point = pk.multiply(sk.secret)
shared_point_bytes = shared_point.format(compressed=False)
x_coord = shared_point_bytes[1:33]
return x_coord
def decrypt_message(encoded_message: str, encryption_key) -> str: