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