Using system;
Namespace encryptcompoent
{
/** // <Summary>
/// Summary of encrypt.
/// </Summary>
Public class Encrypt
{
Public encrypt ()
{
//
// Todo: add the constructor logic here
//
}
MD5 encryption # region MD5 Encryption
/** // <Summary>
/// MD5 Encryption
/// </Summary>
/// <Param name = "strtoencrypt"> </param>
/// <Returns> </returns>
Public static string encryptstring (string strtoencrypt)
{
System. Text. utf8encoding ue = new system. Text. utf8encoding ();
Byte [] bytes = UE. getbytes (strtoencrypt );
// Encrypt bytes
System. Security. cryptography. md5cryptoserviceprovider MD5 = new system. Security. cryptography. md5cryptoserviceprovider ();
Byte [] hashbytes = md5.computehash (bytes );
// Convert the encrypted bytes back to a string (base 16)
String hashstring = "";
For (INT I = 0; I {
Hashstring + = convert. tostring (hashbytes [I], 16). padleft (2, '0 ');
}
Return hashstring. padleft (32, '0'). substring (8, 16 );
}
# Endregion
}
}