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

eKKiM ekkim_pl0x at hotmail.com
Mon Jun 8 20:12:00 EDT 2009


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;
        }
    }
}

-- 
View this message in context: http://www.nabble.com/Framework-vs-Mono-%28MD5-Test%29-tp23934316p23934316.html
Sent from the Mono - General mailing list archive at Nabble.com.



More information about the Mono-list mailing list