Python ed25519 to curve25519

目录

使用 PyNaCl 这个库:pip install PyNaCl

import nacl.bindings

# ed25519 to curve25519
curve25519_key = nacl.bindings.crypto_sign_ed25519_sk_to_curve25519(private_key)

# scalar multiplication: curve25519_key * public
pin_key = nacl.bindings.crypto_scalarmult(curve25519_key, pin_token_bytes)