[Mono-list] Framework vs Mono (MD5 Test)

Sebastien Pouliot sebastien.pouliot at gmail.com
Wed Jun 10 16:02:48 EDT 2009


On Mon, 2009-06-08 at 17:12 -0700, eKKiM wrote:
> Today i was testing .NET Framework and mono to generate MD5 Hashes
> The Results:
> It was the .NET Build didn't test with monodevelop build.
> 
> http://www.nabble.com/file/p23934316/mono%2B%2528l%2529.png 
> 
> 
> 
> I am not a C# Pro my code does look ugly. It don't care..
> so do not bitch me off on that plz =)
> the code:
> 
> namespace MD5SpeedTest
> {
>     class MD5SpeedTest
>     {
>         static void Main(string[] args)
>         {
>             Generat0r Generat00r = new Generat0r("test");
>             TimeSpan executionTime;
>             DateTime startTime = DateTime.Now;
>             
>             for (int i = 0; i <= 1000000;i++)
>             {
>                 Generat00r.GenerateHash("sqdf54q6ez5r4è§!6'5è!'" +
> i.ToString()); //Just Randomstuf + nr for difference
>             }
>             executionTime = DateTime.Now - startTime;
>             Console.WriteLine("Runned for " + executionTime.Seconds + "s, "
> + executionTime.Milliseconds + "ms.");
>         }
>     }
> 
> 
>     class Generat0r
>     {
>         UnicodeEncoding Ue = new UnicodeEncoding();
>         Byte[] ByteSourceText;
>         MD5CryptoServiceProvider Md5 = new MD5CryptoServiceProvider();
>         Byte[] ByteHash;
>         string thePass;
> 
>         public string GenerateHash(string SourceText)
>         {
>             ByteSourceText = Ue.GetBytes(SourceText);
>             ByteHash = Md5.ComputeHash(ByteSourceText);
>             return Convert.ToBase64String(ByteHash);
>         }
> 
>         public Generat0r(string ThePass)
>         {
>             thePass = ThePass;
>         }
>     }
> }

So did you had a question ?

Sebastien

p.s. it's a bad test btw, even if it shows mono as 3 times faster ;-)




More information about the Mono-list mailing list