. Net MD5 application practices

Source: Internet
Author: User

Encrypted strings are one of the key factors to improve system security. Improved encryption calling in vs2005, such as the MD5 method.

I will not talk about the MD5 algorithm. After all, it is not my research. We only need to know about it.

MD5 Algorithm:

Private string getmd5 (string Str)
...{
Byte [] bysrc = system. Text. encoding. Default. getbytes (STR );

Bysrc = new system. Security. cryptography. md5cryptoserviceprovider (). computehash (bysrc );

String md5str = "";

For (INT I = 0; I <bysrc. length; I ++)
...{
Md5str + = bysrc [I]. tostring ("X"). padleft (2, '0 ');
}
Return md5str;
}

 

For example, input:

Test

098f6bcd4621d373cade4e832627b4f6

The encrypted string length is 32 characters.

You can use other tests.

 

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.