dshash
Simple SHA256 hashing library and example utility
dshash C++ class
- located in src/
- A simple implementation of SHA256 with no dependencies.
- Just two files: dshash.cpp and dshash.hpp
- can hash a file, directory tree, or string.
- uses std::array<uint8_t, 32> as the underlying type
- generally used as a std::string, containing the hex representation of the hash.
dshash utility
- located in dshash/
- no dependencies, statically linked
- simple command line utilty to calculate hash of file or directory
- outputs the hash only with a newline
- -v (verbose) mode lists the individual files as they are processed.
Installation
Quick install (recommended)
curl https://getbin.xyz/dshash-install | bash
Manual download
# For x86_64
curl -L -o dshash https://getbin.xyz/dshash:latest-x86_64
# For arm64/aarch64
curl -L -o dshash https://getbin.xyz/dshash:latest-aarch64
chmod +x dshash
Using getpkg
getpkg install dshash
Testing
- Testing of both the C++ class and the dshash utility are in tests/
- ./test.sh runs all tests and returns success only if all pass
- Comprehensive test suite includes:
- Unit tests for the library
- System sha256sum comparison
- NIST test vectors validation
- Stress tests and edge cases
- Performance benchmarks
Publishing
- dshash utility published as a getpkg.xyz package, and also available from getbin.xyz
- Automated CI/CD via Gitea Actions for linux/amd64 and linux/arm64
Description
Languages
C++
64%
Shell
35%
Makefile
1%