Safety numbers¶
Safety numbers let two users compare the cryptographic public identities they currently see.
SafetyNumberGenerator:
- encodes each party's signing and encryption public keys with length prefixes;
- lexicographically orders the two encoded identities so A/B and B/A produce the same input;
- prefixes
Sparrow Safety Number v1; - computes SHA-256;
- converts each two digest bytes into a zero-padded five-digit group.
flowchart LR
A[A signing + encryption public keys]
B[B signing + encryption public keys]
ORDER[deterministic order]
DOMAIN[domain separator]
HASH[SHA-256]
NUM[5-digit groups]
A --> ORDER
B --> ORDER
DOMAIN --> HASH
ORDER --> HASH --> NUM
If a contact's identity changes, the old comparison no longer represents the current identity and verification must be reconsidered.