using System;
using System.Security.Cryptography;
class Class1
{
static void Main(string[] args)
{
string dataToHash = "this is a test";
string key = "ABCDEFGHIJKLMNOPQRSTUVWX";
byte[] dataToHash_Bytes = System.Text.Encoding.Unicode.GetBytes( dataToHash );
byte[] key_Bytes = System.Text.Encoding.ASCII.GetBytes( key );
MACTripleDES mac = new MACTripleDES( key_Bytes );
byte[] result_Bytes = mac.ComputeHash( dataToHash_Bytes );
Console.WriteLine( System.Text.Encoding.ASCII.GetString( result_Bytes ));
MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
byte[] md5_Bytes = md5.ComputeHash( dataToHash_Bytes);
Console.WriteLine( System.Text.Encoding.ASCII.GetString( md5_Bytes ) );
}
}
|