Signature schemes
Ed25519 explained mathematically
The signature attached to every McGesund review — from the curve through the key to the equation the reader's browser recomputes.
Last updated: 2026-09-07
1. What this is about
A review on McGesund is not a text field in a database that you have to take on trust. It is signed digitally when it is submitted, and every visitor can recompute that signature later in their own browser.
For this signature we use Ed25519. Unlike FALCON and ML-DSA, which can be added alongside as stamps, Ed25519 is not optional: every signed review carries it, regardless of plan and submission route.
One thing up front:
Ed25519 is not encryption. The review text is meant to be read. The signature does not prove secrecy, it proves origin and integrity.
2. What exactly gets signed
What is signed is not the running text but a compact data object that pins the text — and everything else — down unambiguously:
{
"v": 1,
"typ": "rev-comment",
"f": "<company ID>",
"c": "<review ID>",
"h": "<SHA-256 of the review text>",
"rh": "<SHA-256 of the entire submission record>",
"rv": 1,
"qh": "<SHA-256 of the QR envelope, QR reviews only>",
"kid": "<key ID>",
"iat": 1757203200
}
This object is encoded as CBOR. That byte sequence — not its tidy rendering above — is our message . Signature and message travel together in one envelope:
The is the format version. Nothing else is in there — in particular no post-quantum signature: if one exists, it sits next to the record, not inside the envelope.
3. What the signature has to achieve
A reader arriving at a company profile faces two questions:
- Does this review really come from the McGesund system?
- Was it altered afterwards?
That is what the key pair is for:
- a private key — stays inside the signing service
- a public key — anyone may have it; it is addressed via the key ID (
kid) in the payload
Signing uses the private key. Verifying uses the public one — in the reader's browser, not on our server. That is the whole point: a check we carry out ourselves and whose result we then report would not be a check, it would be a claim.
4. Why an elliptic curve?
Every signature needs a computation that is easy in one direction and practically impossible in the other. For Ed25519 that is scalar multiplication on an elliptic curve:
Computing the public point from the secret number takes microseconds. Getting from back to is the discrete logarithm problem — no method is known that finishes at this size within human timescales.
The practical gain over older schemes such as RSA is size:
| public key | signature | |
|---|---|---|
| RSA-3072 | 384 B | 384 B |
| Ed25519 | 32 B | 64 B |
At a comparable security level. 64 bytes per review is not a quantity worth thinking about, even with millions of reviews.
5. The edwards25519 curve
Arithmetic happens modulo a prime:
Hence the name. The curve is a twisted Edwards curve:
A "point" is a pair of numbers from satisfying this equation. There is no curve to look at — the drawing in the next section is a visual aid over the real numbers, not a picture of the actual space being computed in.
Two more quantities come into play:
- a fixed, agreed-upon base point ,
- the order of the subgroup generated by :
is prime. That means: adding to itself over and over walks through exactly distinct points and then returns to the start. All arithmetic on scalars therefore runs modulo , all arithmetic on coordinates modulo . Confusing these two numbers is the classic beginner's mistake.
6. Adding points
Two points are combined into a third by a fixed formula:
The neutral element is — the point where the arithmetic starts.
This formula has one property you cannot see in it and that matters more for security than any constant: it is complete. It works for all inputs, with no special cases for "both points are equal" or "the result is the neutral element". The older Weierstrass curves do have those special cases, and each one is a branch in the program — a branch whose running time can be measured. With such schemes, anyone measuring how long a signature takes learns something about the secret key.
Complete formulas mean: always the same path through the computation, always the same time, nothing to measure.
7. Scalar multiplication — the one-way street
means adding to itself exactly times. For an with 253 bits that would be an absurd amount of work — so instead we double:
and assemble the desired from those intermediate results. Around 253 doublings suffice for any . That is the way forward.
Backwards there is no such shortcut. Determining the number from the point means solving the discrete logarithm problem.
In the actual scheme the arithmetic is modulo . There is no "left", no "right" and no proximity there: and become two pairs of numbers with no recognisable relationship.
8. The signing service's key pair
It starts with 32 random bytes, the seed. Everything else is derived from it:
The first half becomes the secret scalar , though not unchanged. Three bits are set or cleared — the so-called clamping:
- the lowest three bits are set to zero: this makes a multiple of 8. The reason is the curve's cofactor 8 — the full point group is eight times the size of the subgroup of order . An divisible by 8 is guaranteed to land in the right subgroup and reveals nothing via small-order points.
- the highest bit is cleared and the second-highest set: therefore always has the same bit length. A shorter would need fewer doublings — and once again the running time would give something away.
The public key is then simply
stored as 32 bytes: the coordinate, with the sign of in the top bit. The verifier recovers from the curve equation itself — the two solutions differ only in sign, and that single bit says which one is meant.
The second half of the hash, the prefix, is not needed for the key. It comes into play in the next section.
9. Why the randomness here is not random
Every signature of this construction needs a one-off value , often called a nonce. It must never repeat: anyone holding two signatures made with the same can work out the secret key with school algebra.
Real systems have failed on exactly this. The best-known case is the signature verification of a games console whose manufacturer used the same nonce every time in 2010 — the private key could be reconstructed publicly as a result.
Ed25519 solves it by using no randomness at all:
The nonce depends on the secret prefix and on the message. Two things follow:
- Two different reviews yield different with overwhelming probability — the repetition case does not arise.
- The same review always yields the same signature. A signing operation can therefore be reproduced, and a poor random generator on the server cannot break anything, because none is needed.
For a review platform with many signatures per day this is not an academic advantage. It is the difference between "a fault in the source of randomness would be fatal" and "there is no source of randomness that could fail".
10. Signing
Three lines, and that is all:
The signature is the pair
32 bytes for the point , 32 bytes for the number — 64 bytes in total.
The second line is worth noting: takes in , the public key and the message. Hashing along is not decoration — it prevents attacks in which a signature is reinterpreted as belonging to a different key.
11. Verifying
The reader's browser knows: the review , the signature and the public key . It recomputes and checks a single equation:
If it holds, the signature is valid. RFC 8032 additionally permits the cofactored form , which is more lenient about a few edge cases.
No server is asked, no service has to be available. The public key is enough.
12. Why the equation works out
Substituting is enough:
The whole trick sits in the middle step: scalar multiplication is compatible with addition. Anyone who knows can compute an that satisfies the equation. Anyone who does not know would have to find a matching for a they did not choose — and that means solving the discrete logarithm.
13. A fully worked miniature example
With the real numbers there is nothing to check by hand — 253-bit values cannot be verified in your head. So here is the same scheme in a tiny group where every step can be followed with a pocket calculator.
Step 1: The group
We work with the residues modulo and take . We have
so generates a subgroup of order . The powers are:
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 2 | 4 | 8 | 16 | 9 | 18 | 13 | 3 | 6 | 12 | 1 |
takes the role of the base point , multiplication the role of point addition. Scalars are computed modulo , values modulo .
Step 2: The key pair
Let the secret be . Then
may be known by anyone.
Step 3: Nonce and commitment
Let prefix and review yield . From that:
Step 4: The challenge
Let the hash over , and the review produce
Step 5: The signature
The signature is the pair .
Step 6: The browser verifies
It computes both sides. Left:
Right, using :
Both sides give :
Step 7: Someone changes the review text
The text goes into the hash, so the challenge changes — say to . The signature stays at , but the right-hand side does not. With :
We can delete a review. We cannot alter it without it showing.
An honest note about the example
The arithmetic here happened in the multiplicative group modulo , not on a curve: stands for , the product for the point addition . The structure is the same, and that is the point. What differs are the magnitudes: versus , and there the key cannot be found by trying out eleven possibilities.
14. What happens if someone changes the review
Suppose someone with database access — including someone at our company — changes the review text or one of the hearts. Then the record changes and with it at least one of the two hash values h and rh in the payload. That changes , hence the challenge , hence the right-hand side of the verification equation. The old signature no longer fits.
The decisive sentence: we can delete a review, but we cannot alter it unnoticed. At McGesund the same check additionally runs nightly on the server across the whole stock — a review that fails it no longer counts towards the company's average.
15. Why an attacker fails
They know the public key , the base point , the curve and every signature issued so far. What they lack is .
The best known classical attack on the discrete logarithm problem in a group of order needs about steps. With that is roughly
operations. For comparison: even a machine managing a billion billion () steps per second would need many times the age of the universe.
Forging without the key would mean finding a matching for a of one's own choosing — the same task in a different disguise.
16. Why Ed25519 and not ECDSA
Both rest on the same problem. The difference lies in everything around it:
| ECDSA (NIST curves) | Ed25519 | |
|---|---|---|
| Nonce | fresh randomness required | deterministic from prefix and message |
| Formulas | special cases, data-dependent branches | complete, one path |
| Curve parameters | origin of the constants never fully explained | chosen from comprehensible criteria |
| Signature size | 64–72 B, variable encoding | fixed 64 B |
| In the browser | available for a long time | native since 2023/2024, otherwise a JS library |
For us the nonce was the deciding argument. A review platform signs often and automatically; a scheme in which a single weak random value gives away the key is the wrong choice for that.
17. What Ed25519 does not achieve
Ed25519 rests on the discrete logarithm — and a sufficiently large quantum computer solves precisely that problem efficiently with Shor's algorithm. Whether and when such machines will exist is open. For a review that should still be verifiable in ten years, it is nevertheless a question to be answered today.
That is why a quantum-resistant stamp can be placed alongside the Ed25519 signature:
- FALCON (FN-DSA) — compact signatures from NTRU lattices
- ML-DSA-87 (FIPS 204) — the completed NIST standard
Neither replaces Ed25519, they sit next to it. If one of the schemes breaks, the other carries on.
18. The process in one picture
19. What McGesund does with it in practice
The envelope. Every signed review carries an MCG1: envelope containing the format version, the payload and the Ed25519 signature. The kid in the payload says which key is meant; the server hands out the corresponding public key on request — it is public, there is nothing about it to protect.
Verification in the browser. Chrome and Firefox have supported Ed25519 natively via the WebCrypto interface since 2023/2024. Safari does not — there the call throws instead of verifying. Our verification code therefore falls back to a pure JavaScript implementation, loaded only where it is needed. The signature check thus runs in every browser, and it runs on the reader's device.
The time anchor. The fingerprint of the signing key is anchored in a Bitcoin block via OpenTimestamps. That makes it possible to show not only that the signature is genuine but also that the key already existed at a particular point in time — without anyone having to believe our timestamp.
The content binding. The payload carries rh, the hash over the entire submission record: text, hearts, geo status, occasion details and origin. The Ed25519 signature therefore binds not just the text but everything displayed next to the review.
20. One sentence to take away
Whoever holds the secret scalar signs in microseconds. Whoever does not would have to solve a discrete logarithm in a group with around elements.
For the reader of a review this simply means: they do not have to believe us. They can do the arithmetic.