MCPcopy Index your code
hub / github.com/HelloZeroNet/ZeroNet / getEcc

Function getEcc

plugins/CryptMessage/CryptMessage.py:36–47  ·  view source on GitHub ↗
(privatekey=None)

Source from the content-addressed store, hash-verified

34
35
36def getEcc(privatekey=None):
37 from lib import pyelliptic
38 global ecc_cache
39 if privatekey not in ecc_cache:
40 if privatekey:
41 publickey_bin = btctools.encode_pubkey(btctools.privtopub(privatekey), "bin")
42 publickey_openssl = toOpensslPublickey(publickey_bin)
43 privatekey_openssl = toOpensslPrivatekey(privatekey)
44 ecc_cache[privatekey] = pyelliptic.ECC(curve='secp256k1', privkey=privatekey_openssl, pubkey=publickey_openssl)
45 else:
46 ecc_cache[None] = pyelliptic.ECC()
47 return ecc_cache[privatekey]
48
49
50def toOpensslPrivatekey(privatekey):

Callers 1

eciesDecryptFunction · 0.85

Calls 2

toOpensslPublickeyFunction · 0.85
toOpensslPrivatekeyFunction · 0.85

Tested by

no test coverage detected