Customers who sign-up prior to 30/06/2024 get unlimited access to free features, newer features (with some restrictions), but for free for at least 1 year.Sign up now! https://webveta.alightservices.com/
Categories
.Net C# Cryptography

BenchmarkDotNet with hash implementation in C#

In earlier blog post:

I have discussed about cryptographic and non-cryptographic hashes.

Here is a Github repo associated with this:

https://github.com/ALightTechnologyAndServicesLimited/Benchmark-Hash-Implementations-in-CSharp

For using BenchmarkDotNet:

Add the nuget package to a console application:

dotnet add package BenchmarkDotNet --version 0.13.7

Create a class and use the attributes [GlobalSetup] for any initialization, use the [Benchmark] attribute for the methods. Use [MemoryDiagnoser] for memory related information.

In the Program.cs use:

BenchmarkRunner.Run<BENCHMARK_CLASS>();

The code in the github repo clearly demonstrates the usage.

In the previous blog post I have mentioned about non-cryptographic hashes for general purposes.

Here are the results:

32 bytes data:

I commented some code and evaluated with more data sizes:

25 KB:

5 MB:

25 MB:

Conclusion:

For non-cryptographic 128 bit hashes use Murmur3.

Mr. Kanti Kalyan Arumilli

Arumilli Kanti Kalyan, Founder & CEO
Arumilli Kanti Kalyan, Founder & CEO

B.Tech, M.B.A

Facebook

LinkedIn

Threads

Instagram

Youtube

Founder & CEO, Lead Full-Stack .Net developer

ALight Technology And Services Limited

ALight Technologies USA Inc

Youtube

Facebook

LinkedIn

Phone / SMS / WhatsApp on the following 3 numbers:

+91-789-362-6688, +1-480-347-6849, +44-07718-273-964

+44-33-3303-1284 (Preferred number if calling from U.K, No WhatsApp)

kantikalyan@gmail.com, kantikalyan@outlook.com, admin@alightservices.com, kantikalyan.arumilli@alightservices.com, KArumilli2020@student.hult.edu, KantiKArumilli@outlook.com and 3 more rarely used email addresses – hardly once or twice a year.