Hash++ also aims to be a suitable alternative to heavier, statically and dynamically-linked libraries such as OpenSSL and Crypto++. I created it keeping in mind the mindset of a programmer who simply wants a header-only file that lets them easily and comfortably "just hash sh*t." Does it really have to be that difficult?
No, it doesn't.
+----------------------------------------------------------------+
| Algorithms | Computational Metrics |
|------------------|---------------------------------------------|
| 64-bit test: | | | |
| [MD5] | 8793 ms | 8.793 s | 1,137,268 hashes/s |
| [MD4] | 7258 ms | 7.258 s | 1,377,790 hashes/s |
| [MD2] | 323220 ms | 323.220 s | 30,939 hashes/s |
| [SHA1] | 10020 ms | 10.020 s | 998,004 hashes/s |
| [SHA2-224] | 13442 ms | 13.442 s | 743,937 hashes/s |
| [SHA2-256] | 13668 ms | 13.668 s | 731,636 hashes/s |
| [SHA2-384] | 10324 ms | 10.324 s | 968,617 hashes/s |
| [SHA2-512] | 10680 ms | 10.680 s | 936,330 hashes/s |
| [SHA2-512/224] | 9748 ms | 9.748 s | 1,025,852 hashes/s |
| [SHA2-512/256] | 9965 ms | 9.965 s | 1,003,512 hashes/s |
|------------------|-----------|-----------|---------------------|
| 32-bit test: | | | |
| [MD5] | 10707 ms | 10.707 s | 933,968 hashes/s |
| [MD4] | 7815 ms | 7.815 s | 1,279,591 hashes/s |
| [MD2] | 204250 ms | 204.250 s | 48,960 hashes/s |
| [SHA1] | 11942 ms | 11.942 s | 837,381 hashes/s |
| [SHA2-224] | 16518 ms | 16.518 s | 605,400 hashes/s |
| [SHA2-256] | 16306 ms | 16.306 s | 613,271 hashes/s |
| [SHA2-384] | 25171 ms | 25.171 s | 397,283 hashes/s |
| [SHA2-512] | 26746 ms | 26.746 s | 373,888 hashes/s |
| [SHA2-512/224] | 24418 ms | 24.418 s | 409,534 hashes/s |
| [SHA2-512/256] | 24343 ms | 24.343 s | 410,796 hashes/s |
+----------------------------------------------------------------+
*Updated as of 11/15/2021; all computed on a stock i9 12900K
hashpp
namespace under class get
(hashpp::get
).
getHash
// function to return a resulting hash from selected ALGORITHM and passed data
constexpr static hashpp::hash getHash(hashpp::ALGORITHMS algorithm, std::string data)
getHashes
// function to return a collection of resulting hashes from selected ALGORITHMS and passed data
static hashpp::hashCollection getHashes(std::vector<std::pair<hashpp::ALGORITHMS, std::vector<std::string>>> algorithmDataPairs)
getFileHash
// function to return a resulting hash from selected ALGORITHM and passed file
static hashpp::hash getFileHash(hashpp::ALGORITHMS algorithm, std::string path)
getFilesHashes
// function to return a collection of resulting hashes from selected ALGORITHMS and passed files (with recursive directory support)
static hashpp::hashCollection getFilesHashes(std::vector<std::pair<hashpp::ALGORITHMS, std::vector<std::string>>> algorithmPathPairs)
getFilesHashes
and some duplicate hashes showing up for different files. This could have been an error on my part during testing, but I am keeping an eye on it.