You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 23, 2025. It is now read-only.
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?
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.
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.