MD5 hexadecimal encryption and md5 hexadecimal Encryption

Source: Internet
Author: User

MD5 hexadecimal encryption and md5 hexadecimal Encryption

There are many MD5 encryption methods. Today we will talk about the MD5 hexadecimal encryption ····

Class Program {static void Main (string [] args) {// 202cb962ac59075b964b07152d234b70 string s = GetMD5 ("123"); Console. writeLine (s); Console. readKey ();} /// <summary> /// MD5 hexadecimal encryption /// </summary> /// <param name = "str"> string to be encrypted </param> /// <returns> string returned after encryption </returns> public static string GetMD5 (string str) {// create the MD5 object MD5 = MD5.Create (); // start encryption // convert the character to a byte array byte [] buffer = Encoding. default. getBytes (str); // returns an encrypted byte array byte [] MD5Buffer = md5.ComputeHash (buffer); // converts a byte array to a string strNew = ""; for (int I = 0; I <MD5Buffer. length; I ++) {strNew + = MD5Buffer [I]. toString ("x2") ;}return strNew ;}}

You can use the GetMD5 method to obtain the desired MD5 hexadecimal encryption.

 

Related Article

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.