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
When input is empty array/span all hashes throws an exception.
var bytes = new byte[0];
var hash = xxHash3.ComputeHash(bytes, bytes.Length); //exception
var span = bytes.AsSpan();
var hash2 = xxHash3.ComputeHash(span, span.Length); //exception
In all hash functions must be guard clause like this
if (data.Length == 0)
return ComputeEmptyHash(seed);
...
private static unsafe uint ComputeEmptyHash(uint seed)
{
var pData = stackalloc byte[1]; //doesn't work with zero
return UnsafeComputeHash(pData, 0, seed);
}
The text was updated successfully, but these errors were encountered:
When input is empty array/span all hashes throws an exception.
In all hash functions must be guard clause like this
The text was updated successfully, but these errors were encountered: