]> git.ipfire.org Git - thirdparty/ccache.git/commit
Encode hash digests as 4 base16 digits + 29 base32hex digits
authorJoel Rosdahl <joel@rosdahl.net>
Tue, 22 Sep 2020 06:34:26 +0000 (08:34 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Wed, 23 Sep 2020 07:52:21 +0000 (09:52 +0200)
commit47cb00f7623ae47deef0ab2fa54e2b73a04b08c9
treee4808a8bf2ca1e9bf4943febe8a6393d6fc8623b
parentf6932174161e5d686f16dead034c03ba2910619d
Encode hash digests as 4 base16 digits + 29 base32hex digits

Reducing file lengths should be beneficial since it reduces the number
of needed system calls when scanning many files in the cache. The effect
is very small but there is no real downside. See also
b16001a67f4389956ef6e7ccf7d8023684b57119.

Base32 is chosen since the encoding algorithm is very simple compared to
e.g. base36. Base64 cannot be used since the encoded digest string is
used in filenames and the cache directory may be located on a case
insensitive filesystem. The base32hex variant is chosen instead of the
other base32 variants since it feels more natural and there are no
visual ambiguity issues.

The first two bytes are encoded as base16 to maintain compatibility with
the cleanup algorithm in older ccache versions and to allow for up to
four uniform cache levels.
src/Digest.hpp
src/Util.cpp
src/Util.hpp
test/suites/base.bash
test/suites/direct.bash
unittest/test_Hash.cpp
unittest/test_Util.cpp