This PR allows an optional public key to be passed to crypto_tweak_ed25519_sign_detached. When provided, the signature is computed ~2x faster.
Motivation:
crypto_sign secret keys are 64 bytes in length, because they include the precomputed public key. Without this information, the public key would have to be computed from the derived scalar, which is roughly as expensive as computing the signature itself.
Since the crypto_tweak takes the scalars directly, we cannot use the same format, so instead we accept the precomputed public key as an optional argument.
This PR allows an optional public key to be passed to
crypto_tweak_ed25519_sign_detached
. When provided, the signature is computed ~2x faster.Motivation:
crypto_sign
secret keys are 64 bytes in length, because they include the precomputed public key. Without this information, the public key would have to be computed from the derived scalar, which is roughly as expensive as computing the signature itself.Since the
crypto_tweak
takes the scalars directly, we cannot use the same format, so instead we accept the precomputed public key as an optional argument.