. Net Core Base64 Encryption decryption

Source: Internet
Author: User
Tags printable characters

I. Description of BASE64

BASE64-bit encryption and decryption in 1..Net core is used in the same way as the. Net Framework

2. The Base64 bit transcoding method is available in the Convert class

Base64 is one of the most common encoding methods for transmitting 8Bit bytecode on the network, and Base64 is a method of representing binary data based on 64 printable characters.

For example: URL transcoding, Base64 pictures in Web pages .....

Second, the Code collation

#regionBase64 bit Encryption decryption/// <summary>///converts a string to base64 format, using the UTF8 character set/// </summary>/// <param name= "Content" >Encrypt content</param>/// <returns></returns> Public Static stringBase64Encode (stringcontent) {    byte[] bytes =Encoding.UTF8.GetBytes (content); returnconvert.tobase64string (bytes);}/// <summary>///convert the base64 format to UTF8/// </summary>/// <param name= "Content" >Decrypt Content</param>/// <returns></returns> Public Static stringBase64decode (stringcontent) {    byte[] bytes =convert.frombase64string (content); returnEncoding.UTF8.GetString (bytes);}#endregion

Test code:

string key = Securityhelper.base64encode ("1234567812345678"//  Mtizndu2nzgxmjm0nty3oa = =string key2=//  1234567812345678

More:

. Net Core Md5 Cryptographic Grooming

Htmlagilitypack of the. Net Core HTML Parsing tool

Use Baidu Online editor Ueditor (GO) in ASP. Core2.0

. Net Core Base64 Encryption decryption

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.