Browse Source

ed25519_get_pubkey

anonswap
tecnovert 4 years ago
parent
commit
9fd55f7b32
No known key found for this signature in database GPG Key ID: 6C1A887B4701EAE3
  1. 1
      .gitignore
  2. 2
      _cffi_build/secp256k1_ed25519.h
  3. 8
      coincurve/ed25519.py

1
.gitignore

@ -14,3 +14,4 @@
/coincurve/_libsecp256k1.py
/coincurve/libsecp256k1.dll
libsecp256k1

2
_cffi_build/secp256k1_ed25519.h

@ -1,2 +1,4 @@
extern const unsigned char ed25519_gen[32];
extern const unsigned char ed25519_gen2[32];
int crypto_scalarmult_ed25519_base_noclamp(unsigned char *q, const unsigned char *n);

8
coincurve/ed25519.py

@ -25,6 +25,14 @@ def get_valid_secret():
return secret
def ed25519_get_pubkey(privkey):
pubkey_output = ffi.new('unsigned char[{}]'.format(32))
privkey_le = privkey[::-1]
rv = lib.crypto_scalarmult_ed25519_base_noclamp(pubkey_output, privkey_le)
assert(rv == 0)
return bytes(ffi.buffer(pubkey_output, 32))
class Ed25519PrivateKey:
def __init__(self, secret=None, context=GLOBAL_CONTEXT):
self.context = context

Loading…
Cancel
Save