md5sum, sha256sum and the other hash commands can ask your VFS for a hash
it already stores, instead of reading and hashing the file. Return None
(TypeScript: null) and Mirage hashes the file.
For example, Google Drive answers md5sum, sha1sum
and sha256sum from the hashes Drive stores.
checksum
The hash of one file.
- Python
- TypeScript
These commands call
checksum, with this algorithm:
md5sum,md5:md5sha1sum:sha1sha224sum:sha224sha256sum:sha256sha384sum:sha384sha512sum:sha512b2sum:blake2b, orblake2b-Nwith-l N
-c: check hashes listed in a file
Example
This example extendsNotesVFS from Custom VFS.
A real service returns the hash it stores; this one computes MD5 and leaves the
others to Mirage:
- Python
- TypeScript
md5sum /notes/hello.txt then reads nothing. sha256sum still reads the page.