ed25519
NB: This code is not safe for use with secret keys or secret data. The only safe use of this code is for verifying signatures on public messages.
Functions for computing the public key of a secret key and for signing a message are included, namely publickey_unsafe and signature_unsafe, for testing purposes only.
The root of the problem is that Python's long-integer arithmetic is not designed for use in cryptography. Specifically, it may take more or less time to execute an operation depending on the values of the inputs, and its memory access patterns may also depend on the inputs. This opens it to timing and cache side-channel attacks which can disclose data to an attacker. We rely on Python's long-integer arithmetic, so we cannot handle secrets without risking their disclosure.
checkvalid_hash(s, m, pk, hashobj=hashlib.sha512)
⚓︎
- symbolchain.external.ed25519.checkvalid_hash
-
Not safe to use when any argument is secret.
See module docstring. This function should be used only for verifying public signatures of public messages.
derive_shared_secret_unsafe(pk, sk, hashobj=hashlib.sha512)
⚓︎
- symbolchain.external.ed25519.derive_shared_secret_unsafe
-
Not safe to use with secret keys or secret data.
See module docstring. This function should be used for testing only.
inv(z)
⚓︎
- symbolchain.external.ed25519.inv
-
$= z^{-1} \mod q$, for z != 0
iscanonical(s)
⚓︎
- symbolchain.external.ed25519.iscanonical
-
public key s is canonical if y coordinate is smaller than prime
q
.
isinmainsubgroup(P)
⚓︎
- symbolchain.external.ed25519.isinmainsubgroup
-
checks if point P is in main subgroup.
pow2(x, p)
⚓︎
- symbolchain.external.ed25519.pow2
-
== pow(x, 2**p, q)
publickey_hash_unsafe(sk, hashobj=hashlib.sha512)
⚓︎
- symbolchain.external.ed25519.publickey_hash_unsafe
-
Not safe to use with secret keys or secret data.
See module docstring. This function should be used for testing only.
scalarmult_B(e)
⚓︎
- symbolchain.external.ed25519.scalarmult_B
-
Implements scalarmult(B, e) more efficiently.
signature_hash_unsafe(m, sk, pk, hashobj=hashlib.sha512)
⚓︎
- symbolchain.external.ed25519.signature_hash_unsafe
-
Not safe to use with secret keys or secret data.
See module docstring. This function should be used for testing only.