-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Description
As far as I can see, BitcoinECC is only used for backwards-compatible methods, which I am not sure are still in use (please correct me if I'm wrong).
BitcoinECC is only used in src/Crypt/CryptBitcoin.py:
ZeroNet/src/Crypt/CryptBitcoin.py
Lines 34 to 43 in bc227b5
| def privatekeyToAddress(privatekey): # Return address from private key | |
| if privatekey.startswith("23") and len(privatekey) > 52: # Backward compatibility to broken lib | |
| bitcoin = BitcoinECC.Bitcoin() | |
| bitcoin.BitcoinAddressFromPrivate(privatekey) | |
| return bitcoin.BitcoinAddresFromPublicKey() | |
| else: | |
| try: | |
| return btctools.privkey_to_address(privatekey) | |
| except Exception: # Invalid privatekey | |
| return False |
ZeroNet/src/Crypt/CryptBitcoin.py
Lines 53 to 57 in bc227b5
| def signOld(data, privatekey): # Return sign to data using private key (backward compatible old style) | |
| bitcoin = BitcoinECC.Bitcoin() | |
| bitcoin.BitcoinAddressFromPrivate(privatekey) | |
| sign = bitcoin.SignECDSA(data) | |
| return sign |
ZeroNet/src/Crypt/CryptBitcoin.py
Lines 60 to 75 in bc227b5
| def verify(data, address, sign): # Verify data using address and sign | |
| if hasattr(sign, "endswith"): | |
| if opensslVerify: # Use the faster method if avalible | |
| pub = opensslVerify.getMessagePubkey(data, sign) | |
| sign_address = btctools.pubtoaddr(pub) | |
| else: # Use pure-python | |
| pub = btctools.ecdsa_recover(data, sign) | |
| sign_address = btctools.pubtoaddr(pub) | |
| if type(address) is list: # Any address in the list | |
| return sign_address in address | |
| else: # One possible address | |
| return sign_address == address | |
| else: # Backward compatible old style | |
| bitcoin = BitcoinECC.Bitcoin() | |
| return bitcoin.VerifyMessageFromBitcoinAddress(address, data, sign) |
I believe the signOld method can be removed immediately since it is only used in tests. The others seem a little more rooted in some useful methods.
What are your thoughts on this lib @HelloZeroNet, is it difficult to just strip out at the moment?
Reactions are currently unavailable