Zero-knowledge file possession and comparison utility.
zkcmp is a minimal Unix utility exploring whether knowledge of a file-derived secret can be demonstrated without revealing the file itself.
Experimental / exploratory software.
The protocol and implementation are still evolving. Do not rely on
zkcmpfor security-critical applications, authentication, or protection of valuable secrets.
zkcmp derives a secret (hash) from a file:
file
|
v
hash
|
v
secret
|
v
commitment
|
v
zero-knowledge proof
The proof is constructed so that the secret itself does not need to be transmitted.
The current implementation uses a Schnorr-style proof of knowledge over a 3072-bit MODP group.
The default hash is SHA-256. SHA3-256 or BLAKE2s-256 can also be selected.
Read more about Schnorr proof.
zkcmp provides four operations:
zkcmp commit file
zkcmp prove file
zkcmp verify commitment proof
zkcmp check file proof
Creates a reusable public commitment from a file.
zkcmp commit release.tar > commitmentA commitment can be published once and used as the public statement for multiple independent proofs.
Creates a proof from a local file.
zkcmp prove release.tar > proofVerifies a proof against a previously created commitment.
zkcmp verify commitment proofThis is useful when a commitment has been published and multiple parties need to demonstrate knowledge of the corresponding secret.
For example:
server$ zkcmp commit release.tar > commitment
alice$ zkcmp prove release.tar > alice.proof
bob$ zkcmp prove release.tar > bob.proof
server$ zkcmp verify commit alice.proof
server$ zkcmp verify commit bob.proofChecks the supplied proof against a local file.
The intended Unix/SSH workflow is:
zkcmp prove release.tar | ssh host 'zkcmp check release.tar -'The current commitment is deterministic.
The same file produces the same commitment when the same hash algorithm is used.
A published commitment can therefore act as a stable identifier.
An observer can recognize repeated use of the same commitment and, if they possess candidate files, can test those candidates against it.
Therefore:
A
zkcmpcommitment should not be considered an unlinkable or strongly hiding commitment.
A proof can therefore provide a zero-knowledge property while the public statement to which it refers remains linkable.
If a reusable public statement is not needed, the check workflow avoids publishing the commitment as a separate object.
On FreeBSD:
make
make installSee LICENSE for licensing information.
Nami Arjmandi