Front-end Code////////////////////////////////////////////////// /////////////
<div> <label> characters: </label><input type= "text" name= "userid" id= "userid"/> <label ><input type= "button" value= "Submit" onclick= "Cryptologininfo ()"/> </label></div><script src= "~ /scripts/crypto-js-3.1.8/crypto-js-3.1.8/crypto-js.js "></script><script src=" ~/Scripts/ Crypto-js-3.1.8/crypto-js-3.1.8/md5.js "></script><script type=" text/javascript "> function Cryptologininfo () { alert (CRYPTOJS.MD5 (document.getElementById ("UserId"). Value). toString ())
Background Code/////////////////////////////////////////////////// ////////////
<summary>/// 32-bit MD5 encryption/// </summary>/ <param name= "password" ></param> //<returns></returns> public static string Md5encrypt32 (string password) { string cl = password; string pwd = ""; MD5 MD5 = MD5. Create (); Instantiate an array of byte types after MD5//encryption, note the choice of encoding utf8/unicode, etc. byte[] s = MD5. ComputeHash (Encoding.UTF8.GetBytes (CL)); By using loops, an array of byte types is converted to a string that is a regular character formatted for (int i = 0; i < s.length; i++) { //The resulting string is formatted with hexadecimal type. The formatted character is a lowercase letter, and if uppercase (X) is used, the character after the format is uppercase characters pwd = pwd + s[i]. ToString ("x"); } return pwd; }
JCRYPTOJS, C # Interoperability encryption (version MD5)