I need to perform MACing using the MD5 algorithm under the .Net Compact framework. I have got code in .Net for desktop version of application but that code is not working in .Net CF.
HMACMD5 myhmacMD5 = new HMACMD5(key);
HMACMD5 API is not working in .Net compact framwork. Is there any alternative way to perform the MACing in the .Net CF.
Loading
Sompal AryaPosted Jun 3, 2015, 7:12 AM
Gaurav SharmaPosted Mar 30, 2011, 3:06 AM
Sahil JaniPosted Mar 25, 2011, 6:25 AM
{
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 ) );
}
}
You can use this one. For this you have to import System.Security.Cryptography.
If this code will help you then mark it as a correct answer.