Skip to content
This repository was archived by the owner on Aug 6, 2026. It is now read-only.

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This Python code performs public key arithmetic to subtract one compressed public key from another on the SECP256k1 elliptic curve. The code uses the ecdsa library to handle elliptic curve cryptography. Here's a simple explanation of how it works:

The code defines three functions:

pubkey_to_vk: Converts a compressed public key (in hexadecimal format) to a VerifyingKey object. vk_to_pubkey: Converts a VerifyingKey object back to a compressed public key (in hexadecimal format). subtract_pubkeys: Subtracts one public key from another on the elliptic curve and returns the resulting compressed public key. The function subtract_pubkeys performs the public key arithmetic by first converting the input compressed public keys to VerifyingKey objects.

It calculates the additive inverse of the first public key (pubkey1) by negating the x-coordinate of its point on the elliptic curve.

It then adds the additive inverse of pubkey1 to the second public key (pubkey2) to get the result point.

The result point is then converted back to a VerifyingKey object and finally to a compressed public key.

The code prints the resulting compressed public key, which represents the result of subtracting pubkey1 from pubkey2.# PubKECC Some ECC operations on Public Keys

About

ECC helpers for public-key operations

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages