aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/git-hooks/commit-msg
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2025-07-22 20:30:03 +0100
committerPádraig Brady <P@draigBrady.com>2025-08-09 22:10:27 +0100
commit02c3d43e3a6559cc60642eff8968d2bae3799c3b (patch)
tree4047b459d58d604e74e646be6d8ae4e8e578c151 /scripts/git-hooks/commit-msg
parentbasenc: fix stripping of '=' chars in some encodings (diff)
downloadcoreutils-02c3d43e3a6559cc60642eff8968d2bae3799c3b.tar.gz
coreutils-02c3d43e3a6559cc60642eff8968d2bae3799c3b.zip
basenc: add base58 support
A 58 character encoding that: - avoids visually ambiguous 0OIl characters - uses only alphanumeric characters Described at: - https://tools.ietf.org/html/draft-msporny-base58-03 This implementation uses GMP (or gnulib's gmp fallback). Performance is good in comparison to other implementations. For example when using libgmp on an i7-5600U system, encoding is 530 times faster, and decoding 830 times faster than the implementation using arbitrary precision ints in cpython 3.13. Memory use is proportional to the size of input. Encoding benchmarks: $ time yes | head -c65535 | src/basenc --base58 -w0 >file.enc real 0m0.018s ./configure --quiet --without-libgmp && make -j $(nproc) $ time yes | head -c65535 | src/basenc --base58 -w0 >file.enc real 0m3.431s # dnf install python3-base58 $ time yes | head -c65535 | base58 >file.enc # cpython 3.13 real 0m9.700s Decoding benchmarks: $ time src/basenc --base58 -d <file.enc >/dev/null real 0m0.010s $ ./configure --without-libgmp && make # gnulib gmp $ time src/basenc --base58 -d <file.enc >/dev/null real 0m0.145s $ time base58 -d <file.enc >/dev/null # cpython 3.13 real 0m8.302s * src/basenc.c (base_decode_ctx_finalize, base_encode_ctx_init, base_encode_ctx, base_encode_ctx_finalize): New functions to provide more general processing functionality. (base58_{de,en}code_ctx{_init,,_finalize}): New functions to accumulate all input before calling ... (base58_{de,en}code): ... the GMP based encoding/decoding routines. (do_encode, do_decode): Call the ctx variants if enabled. * doc/coreutils.texi (basenc invocation): Describe the new option, and indicate the main use case being interactive user use. * src/local.mk: Link basenc with GMP. * tests/basenc/basenc.pl: Add test cases. * NEWS: Mention the new feature.
Diffstat (limited to 'scripts/git-hooks/commit-msg')
0 files changed, 0 insertions, 0 deletions