Click here to Skip to main content
15,567,415 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Do you know any hash function, with an implementation in c#, that I can use to produce a 16 standard char output?

MD5 outputs 16 bytes, I want to use just AZaz09 chars.

Using 26+10 alphanumeric char the collision probability is 1/(36^(16/2)) = 1/ 2.821109907456 x 10^12

Using an byte to hex conversion it should be 16 chars ^ (16/2) = 4.294967296 x 10^9

It really satisfies me. But I cannot found it on google.
Can you help me?
Updated 17-Sep-10 3:42am

1 solution

MD5 returns 16 characters as you requested. But now no security expert advises the use of MD5 - you should use more than 16 chars - check SHA.

MD5 is implemented in .NET framework - the MD5 class - for an example check this link[^]

Or if you want it from scratch - here is the source code of MD5 implementation using C#[^]
Share this answer
[no name] 17-Sep-10 8:41am    
Reason for my vote of 5
Automatic vote of 5 for accepting answer.
[no name] 17-Sep-10 9:35am    
I'd like to use only alphanumeric char. MD5 outputs 8 bytes.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900