Re: System.Security.Cryptography.MD5CryptoServiceProvider
From: Sébastien Pouliot (spouliot_at_videotron.ca)
Date: 10/16/03
- Previous message: Mike: "System.Security.Cryptography.MD5CryptoServiceProvider"
- In reply to: Mike: "System.Security.Cryptography.MD5CryptoServiceProvider"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Wed, 15 Oct 2003 22:28:12 -0400
They all work.
using System;
using System.Security.Cryptography;
using System.Text;
public class MD5Test {
public static void Main (string[] args)
{
MD5 hash = MD5.Create ();
byte[] data = new byte [0];
byte[] empty = hash.ComputeHash (data);
Console.WriteLine (BitConverter.ToString (empty));
data = Encoding.ASCII.GetBytes ("a");
byte[] a = hash.ComputeHash (data);
Console.WriteLine (BitConverter.ToString (a));
data = Encoding.ASCII.GetBytes ("abc");
byte[] abc = hash.ComputeHash (data);
Console.WriteLine (BitConverter.ToString (abc));
}
}
One common error in using hash with .NET is hashing a unicode string.
Sebastien
"Mike" <no_spam_plz@mypse.com> wrote in message
news:093b01c39389$64b8c860$a301280a@phx.gbl...
> I'm wonder if anyone has tested the
> System.Security.Cryptography.MD5CryptoServiceProvider
> against the RFC 1321 Test suite?
>
> For example, here is the list of string to hash for md5:
> MD5 ("") = d41d8cd98f00b204e9800998ecf8427e
> MD5 ("a") = 0cc175b9c0f1b6a831c399e269772661
> MD5 ("abc") = 900150983cd24fb0d6963f7d28e17f72
>
> I haven't been able to these result? Has anyone gotten it
> to work? If yes, what did you have to do?
- Previous message: Mike: "System.Security.Cryptography.MD5CryptoServiceProvider"
- In reply to: Mike: "System.Security.Cryptography.MD5CryptoServiceProvider"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|