Ed25519 Signs the Same Way Twice
Ed25519 derives its per-signature number from the key and the message, so the same key and message give the same 64 bytes every time; one command reproduces the fixed signature of a test key, and a program signs twice with a fresh key.
The question
The last lesson showed ECDSA signatures that differ on every run. Ed25519 is another elliptic-curve signature scheme, and its signatures do not: the same key and the same message give the same 64 bytes. How can a signature be correct without fresh randomness, and what does the scheme use instead?
The key in this lesson, signer of the Ed25519 test material, is a test key made for these lessons. Its signature of one fixed message was made once and is the value Check compares with.
Work it by hand
RFC 8032 section 8.2 says it plainly: "EdDSA signatures are deterministic." Section 5.1.6 gives the steps for Ed25519. The private key is a 32-byte seed.
- Hash the seed with SHA-512. The first half, adjusted by the rules of the RFC, is the secret scalar; the second half is called the prefix.
- Hash the prefix followed by the message and read the 64 bytes as a number r. The point r times the base point, encoded in 32 bytes, is R.
- Hash R, the public key and the message, and read the result as a number k.
- Compute S as r plus k times the secret scalar, modulo the group order L.
- The signature is R followed by S, 32 and 32 bytes: 64 bytes.
Everything the signer "randomly" needs, the number r, comes from the prefix, which only the key holder knows, and from the message. The same inputs give the same r and the same signature. The oracle of this lesson follows these steps with Python integers and reproduces the fixed signature of the test key.
Run it
The program makes a fresh Ed25519 key with ssl.gen_ed25519, signs one message twice and verifies the signature. For Ed25519 the digest name is an empty text: the scheme hashes inside itself. It returns three numbers: 1 if the two signatures are equal, the length of the first in bytes, and 1 if it verifies.
The answer is 1, 64, 1 on every run: equal, 64 bytes, valid. The key is different on every run, and the answer is not.

Public test material, generated for this lesson. Never use it for anything real.
let k = ssl.gen_ed25519();
let first = k.sign("", message);
let second = k.sign("", message);
let answer = int_list();
answer.add(0);
if (first == second) { answer.set(0, 1); }
answer.add(str_len(first) / 2);
answer.add(0);
if (k.verify("", message, first)) { answer.set(2, 1); }
lmcode_return_put("type", k.type());
{
"answer": [
1,
64,
1
],
"type": "ED25519"
}You can change the message to any text, including an empty one. The answer stays 1, 64, 1. The signature itself is not returned, because it depends on the fresh key.
Your turn
The command below should sign the file in/message.txt with the Ed25519 private key in in/key.txt and write the 64 signature bytes to out.bin. Decide whether it does, and edit it so that it does. Check runs your command on the data shown and on four others, each a different message.

Public test material, generated for this lesson. Never use it for anything real.
# Reads the private key in in/key.txt and the message in in/message.txt.
# Writes 64 bytes to out.bin. Check runs it with other messages.
dgst -sha256 -sign in/key.txt -out out.bin in/message.txt
{
"message": "Error setting context: invalid digest"
}Write one command that signs the file in/message.txt with the Ed25519 private key in in/key.txt and writes the 64 signature bytes to out.bin. Check runs your command with other messages in that file, one of them empty.
Read the result carefully
A deterministic signature has no random number to get wrong: a program that signs with a poor random generator cannot weaken the signature, because it uses none. That is a property of the design. It does nothing for a key that leaks, and it does not hide the message or say when it was signed.
OpenSSL signs the whole message in one step for this scheme. The page does not show the context and pre-hash variants that RFC 8032 names, key storage or certificates. The test key is public and must never protect anything real.
Recap
- Ed25519 signatures are deterministic: RFC 8032 section 8.2.
- The number r comes from a hash of the key's prefix and the message, so the same key and message give the same 64 bytes.
- The signature is R then S, 32 bytes each.
- A fixed message under a fixed key gives a fixed 64 bytes, which is why Check can compare bytes.