I'm trying to write a hash function with Botan as my back end that is:
std::string hex_hash(std::string &in, const std::string &HASH)
{
std::unique_ptr<Botan::HashFunction> hash(Botan::HashFunction::create(HASH));
return Botan::hex_encode(hash->process(in));
}
HASH
is a std::string
that is the name of the hash requested. i.e. "SHA-512"
for SHA512 and "BLAKE2b"
for BLAKE2b
Any other hash supported by botan gets processed and outputted, but BLAKE2b doesn't and throws an exception:
Exception thrown at 0x00007FF661382C5A in test.exe: 0xC0000005: Access violation reading location 0x0000000000000000.
And then crashes.
I did notice in the manual for botan (https://botan.randombit.net/manual/hash.html) that
BLAKE2b
Available if BOTAN_HAS_BLAKE2B is defined.
A recently designed hash function. Very fast on 64-bit processors. Can output a hash of any length between 1 and 64 bytes, this is specified by passing a value to the constructor with the desired length.
Is it possible that there is no default set? How would I set it? Is it possible I have the wrong name?