(1) time for i in md5 sha1 sha256; do nettle-hash -a $i < /tmp/test ; done
(2) time for i in md5 sha1 sha256; do openssl $i < /tmp/test ; done
(3) ./a.out < /tmp/test
where a.out is
#include <apt-pkg/hashes.h>
#include <iostream>
int main(void)
{
Hashes h(Hashes::MD5SUM | Hashes::SHA1SUM | Hashes::SHA256SUM);
h.AddFD(0);
auto hsl = h.GetHashStringList();
Tests run (for SHA256, add SHA512 as needed):
(1) time for i in md5 sha1 sha256; do nettle-hash -a $i < /tmp/test ; done
(2) time for i in md5 sha1 sha256; do openssl $i < /tmp/test ; done
(3) ./a.out < /tmp/test
where a.out is
#include <apt-pkg/hashes.h>
#include <iostream>
int main(void) List();
{
Hashes h(Hashes::MD5SUM | Hashes::SHA1SUM | Hashes::SHA256SUM);
h.AddFD(0);
auto hsl = h.GetHashString
for (HashString const &h : hsl)
std::cout << h.toStr() << std::endl;
return 0;
}
compiled with g++ -lapt-pkg -O2