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
I am using the 1.0.0 package from Nuget and compiling on a Debian bookworm x86_64 system. If I run the following code:
class Program
{
static void Main()
{
var data = new byte[] { 1, 2, 3};
Hash1(data);
Hash2(data);
}
static void Hash1(byte[] data)
{
var hash = Blake3.Hasher.Hash(data);
System.Console.WriteLine($"Hash 1 completed: {hash}");
}
static void Hash2(byte[] data)
{
var hasher = new Blake3.Hasher();
hasher.Update(data);
var hash = hasher.Finalize();
System.Console.WriteLine($"Hash 2 completed: {hash}");
}
}
I get this error:
Unhandled exception. System.NullReferenceException: The Hasher is not initialized or already destroyed.
at Blake3.Hasher.ThrowNullReferenceException()
at Blake3.Hasher.Update(ReadOnlySpan`1 data)
at Program.Hash2(Byte[] data) in /home/fpr/fast_block_upload/c_sharp/main.cs:line 19
at Program.Main() in /home/fpr/fast_block_upload/c_sharp/main.cs:line 7
Prior to attempting to simplify this example, I was encountering segmentation faults which in gdb pointed to blake3_finalize. Invoking Blake3.Hasher.Hash seems to work fine though.
The text was updated successfully, but these errors were encountered:
Ah, I see the problem. You need to construct a Hasher with the static function Hasher.New. If you call new Hasher() you will get back a hasher which hasn't had its internal hasher initalized.
I'm going to leave this open, as it seems peculiar to me to not have the default constructor provide a functional hasher or for there to not be a stronger defence against this.
I am using the 1.0.0 package from Nuget and compiling on a Debian bookworm x86_64 system. If I run the following code:
I get this error:
Prior to attempting to simplify this example, I was encountering segmentation faults which in gdb pointed to
blake3_finalize
. InvokingBlake3.Hasher.Hash
seems to work fine though.The text was updated successfully, but these errors were encountered: