Skip to content

Commit 4c19f0a

Browse files
committed
Restore SHA256 / Blake2 benchmarks
1 parent 23973d2 commit 4c19f0a

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

src/Blake3.Benchmarks/Program.cs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,19 @@ public uint RunBlake3ManagedParallel()
5656
return MemoryMarshal.Cast<byte, uint>(hasher.Finalize().AsSpan())[0];
5757
}
5858

59-
//[Benchmark(Description = "Blake2Fast")]
60-
//public void RunBlake2Fast()
61-
//{
62-
// Blake2b.ComputeHash(_data);
63-
//}
59+
[Benchmark(Description = "Blake2Fast")]
60+
public uint RunBlake2Fast()
61+
{
62+
return MemoryMarshal.Cast<byte, uint>(Blake2b.ComputeHash(_data))[0];
63+
}
6464

65-
//[Benchmark(Description = "SHA256")]
66-
//public unsafe void RunSHA256()
67-
//{
68-
// Span<byte> data = stackalloc byte[32];
69-
// System.Security.Cryptography.SHA256.HashData(_data.AsSpan(), data);
70-
//}
65+
[Benchmark(Description = "SHA256")]
66+
public unsafe uint RunSHA256()
67+
{
68+
Span<byte> data = stackalloc byte[32];
69+
System.Security.Cryptography.SHA256.HashData(_data.AsSpan(), data);
70+
return MemoryMarshal.Cast<byte, uint>(data)[0];
71+
}
7172

7273
static void Main(string[] args)
7374
{

0 commit comments

Comments
 (0)