JCRYPTOJS, C # Interoperability encryption (version MD5)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.