some buffer including '\0' - such as "The apple is\0 delicious!" - cannot be calculated true hash value by myWrapper->getHashFromString() function. It will only calculate hashes for "The apple is" substring because std::string constructor cut off the buffer when it meet '\0'. Then the text.length() would also be wrong, because std::string cannot calculate the correct length of the buffer.
Who know more about the bufferlen than the caller?
A little bit better solution is:
virtual std::string getHashFromString(const char* text, unsigned long textlen)
{
resetContext();
updateContext((unsigned char*)text, textlen);
return this->hashIt();
}
use LPCSTR pointer to transmit buffer parameter and the length of the buffer. The length is gaven by the caller, and it needn't construct a std::string object in runtime.