E-signatures · Glossary

What is a document hash?

A document hash is a fixed length string computed from every byte of a file. Change one character, one pixel or one date and the string changes completely. It works one way, so the file cannot be reconstructed from the hash, which makes it a compact fingerprint rather than a copy.

Hashes turn a vague question about whether a document changed into an exact one. The catch is knowing which version of the file each hash was taken from.

· Co-founder

5 min read · Published

Three hashes exist around one signed document
HashTaken fromWhere it appears
Document hash as sentThe uploaded file, before anybody signedThe certificate of completion, in the envelope section
Fully signed hashThe stamped file, before the final certificationThe certificate of completion, in the envelope section
Hash of the file you downloadedThe completed PDF, after certificationComputed by you, and stored internally, but not printed

One way, and violently sensitive

A hash function takes input of any length and returns a fixed length output, commonly two hundred and fifty six bits written as sixty four hexadecimal characters. Two properties make it useful. It is deterministic, so the same bytes always give the same string, and it is one way, so the string reveals nothing about the content. The third property is the one people notice: a single bit flip changes roughly half the output, which is why a hash cannot tell you how much a document changed, only that it did. There is no partial match and no nearly the same.

What a hash proves, and to whom

By itself, very little. Anybody can hash any file, so a hash printed on a page proves nothing unless the reader knows it came from a source they trust and covers the file they are holding. Its power comes from binding: when a hash is signed, or chained into a log, or recorded by a party with no interest in the outcome, it becomes evidence that a specific set of bytes existed in a specific state. That is why hashes appear inside signatures and audit records rather than as standalone claims.

Why a signed document ends up with several

A signing process changes the file more than once. It starts with the document as uploaded. Each signature stamps marks onto it, producing a new version. At the end the whole thing is sealed, which appends a signature structure and changes the bytes again. Each of those states can be hashed, and each answers a different question: what was sent, what everybody signed, and what is being distributed now. Printing more than one is not redundancy, it is the only way to describe a file that legitimately changed several times.

The comparison that does not work

The two hashes printed on the certificate of completion are the document as sent and the fully signed file before certification. Neither of them is the hash of the PDF you download, because certification happens afterwards and alters the bytes. Hashing your copy and comparing it against either printed value will produce a mismatch every time, and it means nothing at all. That value is recorded internally against the completed file, but it is not printed on the certificate, so the certificate is not the place to verify your download.

How to check integrity properly

Open the completed PDF in a reader that shows the signature panel. The signature covers the byte ranges of the finished file, so the reader can tell you whether anything changed after certification, which is the question people are usually trying to answer with a hash comparison. If you need a hash of your own copy for a register, compute it and store it alongside the file, then compare future copies against your own value rather than against a printed one taken at a different stage.

Where hashes appear elsewhere in the record

The certificate lists a document hash at signing for each signer, so it is possible to see that everybody signed the same document rather than different versions. The signature image each signer produced is stored with its own hash. And the event log itself is chained with hashes so that a rewritten entry breaks the sequence, which is covered on the hash chain page. Together these turn a set of claims about a signing into a set of checkable statements about bytes. The signature image hash is the least obvious of them and quietly useful. A drawn or typed mark is stored as an image file, and hashing it means the mark printed on the document can be tied to the file the signer produced, rather than to any similar looking image. It also means a reused image is detectable, since the same mark applied to two documents produces the same fingerprint in both records. Spotting that repetition is often the first sign that an image was copied rather than drawn.

Questions people ask

Which algorithm is used?

SHA-256, which is the current default across signing, certification and the event log. It produces a sixty four character hexadecimal string. Older algorithms such as MD5 and SHA-1 are considered broken for this purpose because it is feasible to construct two different files with the same output.

Can two different documents have the same hash?

In theory yes, since infinite inputs map to a finite output space, but for SHA-256 no practical method exists to find such a pair deliberately. That is what makes the fingerprint reliable in evidence. When a hash algorithm is called broken, it means somebody found a shortcut to constructing collisions.

Does the hash change if I rename the file?

No. Hashing covers the contents, not the file name or its location. It does change if the file is re-saved by a viewer, because the viewer may rewrite the internal structure even when the visible content looks identical. Copying without opening leaves the bytes alone.

How do I compute a hash myself?

Most operating systems ship a command line tool, and any file checksum utility will do it. Compute it on the file exactly as received, before opening and saving it anywhere. The most common cause of an unexpected mismatch is a document that was opened and re-saved between the two measurements.

Why not print the final hash on the certificate?

Because the certificate has to be produced before the file is certified, and appending it afterwards would break the certification. That ordering is a consequence of sealing the document at the strictest permission level. The final value is recorded internally against the completed file rather than printed on a page inside it.

Is a hash the same as a signature?

No. A hash is a fingerprint anybody can compute. A signature is that fingerprint encrypted with a private key, which is what ties it to a specific holder and makes it hard to forge. Hashing gives you integrity; signing gives you integrity plus attribution.

Make one with e-signatures

The button opens the generator with this use case already described. Change the wording to match your own.

Send a document for signing

Related questions

Sources

Written and checked by the OneCraft team. Last checked .