1 unstable release
0.4.0 | Oct 6, 2023 |
---|
#1389 in Filesystem
22KB
89 lines
rblake3sum
A recursive blake3 digest (hash) of a file-system path. A fork of rblake3sum
.
The recursive file-system digest algorithm used is described in a underlying library crev-recursive-digest.
Under the hood, it uses walkdir
and
blake3
, with efficient IO handling, which makes
it fast.
Using
$ rblake3sum /usr/
f60d19435bb5e859d911c6600dcf96856dfce5de94d4fefd2b2675051ac10fc36dbde87fd86a30eb5224209b47263eb546bd9e3d7bdf64c1f26a7dccf51809af /usr/
$ rblake3sum --help
rblake3sum 0.2.0
Dawid Ciężarkiewicz <dpc@dpc.pw>
Calculate recursive blake3 digest for path or directory
USAGE:
rblake3sum [FLAGS] [paths]...
FLAGS:
--base64
-h, --help Prints help information
-V, --version Prints version information
ARGS:
<paths>...
Installing
You can compile from source, using cargo
:
cargo install rblake3sum
or use precompiled release binaries.
Notes
This tool calculates a digest of a content of a path. To illustrate:
$ mkdir a
$ touch a/file
$ cp -r a b
$ rblake3sum a b
3ecc0360bcfc32fd672443ecbe9b7e278be9e0a731cfedb4ada782bf9753ddd8768d467fcb7ee0b6e5920d1fe3352a6314f2ba73f3cfb3eed7c1a88dfe92cc38 a
3ecc0360bcfc32fd672443ecbe9b7e278be9e0a731cfedb4ada782bf9753ddd8768d467fcb7ee0b6e5920d1fe3352a6314f2ba73f3cfb3eed7c1a88dfe92cc38 b
Different path, same content. However:
$ mv a/file a/differentfile
$ rblake3sum a
6e4a518652881f356d863ae034e7508648455536e5393824b5cc96232786a4733ffb9c3cdd62bda4741ca0bfe60a181f6ae47959ceb0493716699e9b28f686ac a
The name of the files or directories in the path is a part of its content.
In the simplest case, a rblake3sum
of a file is like a normal b2sum
of the content, except
prefixed with an F
(to denote the type of the path). To illustrate:
$ echo -en "F" > f
$ cat f differentfile | hexdump -C /dev/stdin
00000000 66 |f|
00000001
$ cat f differentfile | b2sum /dev/stdin
c4df78482e7b82e1eea4026a9f61732a62a15a1741737a539733713c2beb3e0057f076934e9fb60646771a4d9084d32a8e48fe838108a842262cf2aad996fa26 /dev/stdin
$ rblake3sum differentfile
c4df78482e7b82e1eea4026a9f61732a62a15a1741737a539733713c2beb3e0057f076934e9fb60646771a4d9084d32a8e48fe838108a842262cf2aad996fa26 differentfile
$ echo "foobar" > file
$ cat f file | b2sum /dev/stdin
96178099394650380ee4bb34aed2eae3ef7a7782adbec3a9aeb436697544b63ed0218ff1240ea1823539183c5e183f211fa8d092bfebe351dc34f77047bceeec /dev/stdin
$ rblake3sum file
96178099394650380ee4bb34aed2eae3ef7a7782adbec3a9aeb436697544b63ed0218ff1240ea1823539183c5e183f211fa8d092bfebe351dc34f77047bceeec file
Dependencies
~3–11MB
~129K SLoC