How DigiHan works
DigiHan is a free digital stamp you make to sign or validate a file without corporate intermediaries or central authorities.
The parts of a seal
1
2
3
4
5
- Center artworkYours to define: characters, a signature, a crest. Its SHA-256 hash (32 bytes) is registered with your public key and signed into every seal you make.
- BridgesEight tabs. The wide one at 12 o'clock shows the scanning camera which way is up.
- Locator ringTells the camera the ring's size and tilt.
- Data ring1,012 dots in five tracks: 78 bytes of data (described below) plus error correction.
- RimThe outer edge of the seal.
What the ring holds
| Part | Size | What it is |
| Version | 1 byte | The format version, and which time proof the seal uses. |
| Public key id | 8 bytes | The public key's fingerprint: the first 8 bytes of the SHA-256 hash of the signer's public key. The scanner uses it only to find the full public key. |
| Time | 5 bytes | The time of the seal’s placement, or for an anchored seal placement, a Bitcoin block number. |
| Signature | 64 bytes | A Schnorr signature (BIP340), the kind Bitcoin uses. |
How it fits together
1On signing
Your private key signs your document. The signature becomes the ring of dots around your artwork.
2After signing
You get back one PDF. Page 1 shows the seal. If your document was a PDF, its original pages follow; a text file or a picture is shown on the pages after the seal. Attached inside the PDF file itself (PDF readers such as Adobe Acrobat list them as attachments): your file unchanged, your public key, your artwork, and the Bitcoin time proof if you chose one.
3The check
The camera reads the ring. You load the stamped PDF or the original file. The scanner compares the two on the phone; your file is not uploaded to the internet.
The ring holds a signature of the document, not the document itself. So a seal is always checked together with the exact file that was stamped.
Signing / Stamping details
Your private key signs four things together: the loaded file's SHA-256 hash (32 bytes), the time, your public key id (the 8-byte fingerprint of your public key) and your artwork's SHA-256 hash (also 32 bytes). Change one byte of the document and the signature no longer matches.
In detail, when you tap Stamp:
- The file. The page reads the file you loaded and makes its SHA-256 hash: 32 bytes made from every byte of the file. The file is not sent anywhere.
- The time. The page takes the time from your device's clock (seconds since 1 January 1970, UTC) and writes it in 5 bytes. This time is your statement; on its own it proves nothing.
- The Bitcoin block, if you chose “no earlier than”. The page asks two Bitcoin sites (mempool.space and blockstream.info) for the block two below the newest one, and uses it only if both give the same answer. The 5 time bytes then hold that block's number instead of the clock time, and the block's 32-byte hash is a fifth thing that is included to be signed. Nobody can know a block's hash before the block exists, so the seal was made after it.
- Your public key id. The first 8 bytes of the SHA-256 hash of your public key.
- Your artwork. The SHA-256 hash of the exact artwork image registered with your public key (32 bytes).
- One hash of everything. The page joins these in a fixed order: file hash (32 bytes), time (5), public key id (8), artwork hash (32), and the block hash (32) if there is one. That is 77 or 109 bytes. It makes one SHA-256 hash of them, marked as DigiHan's (“DigiHan/v1”) so the signature cannot be passed off as a signature on anything else.
- The signature. Your private key signs that 32-byte hash. The result is a 64-byte Schnorr signature (BIP340). How a signature works: your private key is a secret number, and your public key is made from it by a calculation that cannot be run backwards, so the public key does not reveal the private key. Signing is a calculation on the private key and the hash from step 6 that gives 64 bytes. Your password unlocks the private key only for this moment, and the page clears it from memory right after.Before going on, the page checks the new signature against your public key: the same check the scanner makes later (see Checking). A signature that fails is not used.With a key kept offline, the page shows the 32-byte hash as a 64-character value; you sign it on your own computer and paste back the 128-character signature.
- The ring. The ring stores 78 bytes: version (1), public key id (8), time or block number (5) and the signature (64). The file hash, artwork hash and block hash are not stored in the ring: a checker makes them again from the file, the registered artwork and Bitcoin.
- The read-back check. The page draws the seal and reads it back the way the scanner does. If it does not read back exactly, nothing is saved.
- “No later than”, if you chose it. The SHA-256 hash of the ring's 78 bytes is sent to OpenTimestamps servers, which record it in a Bitcoin block within a few hours. This is not part of the signature; it proves the finished seal existed by that block. Step 3 on the stamping page collects the finished proof.
- The PDF. Page 1 shows the seal. Your file is attached unchanged, with your public key's registration, your artwork and the timestamp proof.
Your private key is made on your device and never leaves it. Or you can keep it elsewhere, and the page asks for a signature once when you set up your seal and once for each document:
- A Nostr signer. A Nostr app or browser extension that holds your private key. It shows you what it signs, and you approve each stamp in it. A Nostr signer signs only Nostr events, so for these stamps the parts in steps 1 to 5 are written as a Nostr “stamp event”, and the signature in step 7 is over that event's 32-byte id instead of the hash in step 6. The ring and the checking are the same; the ring's version byte says which way it was signed.
- A second device. A phone or computer that holds your private key signs for this one by QR code: it shows what it is about to sign, and it can stay offline.
- Your own computer, offline. The page shows a code; you sign it there and paste the signature back.
Checking
- Open the scanner and point the camera at the seal. Or tap the picture-and-folder button and choose a photo or screenshot of the seal, or the stamped PDF or stamped picture itself; neither needs the camera.
- Tap Check against a document… and pick the stamped PDF or the original file. It is read on the phone and not uploaded. (The sample seals on this site need no file.)
Checking a signature is a second calculation, on the signer's public key, the hash rebuilt from the file as in step 6, and the 64 bytes in the ring. It answers yes or no. It answers yes only if the matching private key signed exactly that hash: change one bit of the hash, or use another public key, and it answers no.
What the scanner checks
- Public keyThe ring holds the public key id. The scanner finds the public key with that id: inside the stamped PDF or stamped picture, saved on the phone, on this site's sample list, or on Nostr.If none is found:
Seal read
, and the signer's public key is asked for
- DocumentThe scanner makes the SHA-256 hash of the file you pick (32 bytes, made from every byte of the file). The signature must match the hash of the document and the signer's public key exactly. One changed byte and it fails.If not:
Signature does NOT match
- ArtworkThe artwork's SHA-256 hash is part of what was signed. The scanner shows the registered artwork; compare it with the center of the seal in front of you. A match does not show who signed: anyone can register a copy of any artwork.If the pictures differ, the seal's center was changed.
- TimeIf the seal has Bitcoin time proofs, their block numbers are checked against Bitcoin.If they disagree:
Time proofs contradict
- Who signedA valid signature shows only that the private key of that public key signed. The scanner shows the signer as known only for a public key you saved on your phone, a sample seal on this site, or a name such as [email protected] that the domain itself confirms. A public key found only inside the file or on Nostr was put there by whoever made the seal: anyone can make a seal with the same artwork and their own private key.A public key the phone does not know:
Signature valid for this file · signer unknown
, with the full public key to check with the signer. A name its domain does not confirm: Name NOT confirmed
The result is one line per check. Each line names the item and where it came from, and what it is checked against and where that came from, then the result: Match, No match, or Not checked, and why. Marks: ✓ passed, ✗ failed, ! not known, – none, … waiting.
- The signature in the seal's ring, checked with the public key, against the SHA-256 hash of the document file. A match means the signature was made with that public key's private key, over that exact file.
- The public key (from the registration inside the stamped file, a Nostr relay, the phone or this site's sample list) against the public keys saved on the phone and on this site's sample list.
- The name in the public key's Nostr profile against the name file on that name's website.
- The artwork registered for the public key against the center of the seal, by eye.
- The Bitcoin block hash signed in the seal against that block at mempool.space and blockstream.info.
- The OpenTimestamps proof against the Bitcoin block at mempool.space and blockstream.info.
When every check passes and the public key is known, the scanner says Signature valid for this file.
Showing your name
In step 1 of the stamping page, give a name such as [email protected]. The page puts it in your public key's Nostr profile (NIP-05) and shows a small file for your website, at /.well-known/nostr.json, that lists your public key under that name. Scanners then show your name with your seals. Anyone can write your name into the profile of their own public key, but only your website can list a public key under your name.
Time
A plain seal carries the time the signer states; nobody can change it afterwards. Two proofs pin it to Bitcoin:
No earlier than. The seal signs the hash of a recent Bitcoin block. Nobody knows a block's hash before the block is mined, so the seal was made after it.
No later than. The seal's 78 bytes are timestamped with OpenTimestamps, which records them in a Bitcoin block. The seal existed when that block was mined.
Sometime between and including Block A and Block B
A seal with both proofs is bookended. The window is usually one to a few hours.
Open
The format is public domain and anyone may build on it. The code is open source (Apache-2.0): github.com/dav1dpgit/digihan, with the full specification in SPEC.md.