using System;
using System.Collections.Generic;
using System.Text;
namespace MyLibs.encrypt
{
public class Base64
{
private static string base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";//编码后的字符集
private static int[] base64DecodeChars = new int[] { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1 };//对应ASICC字符的位置
public static string base64encode(string str)
{ //加密
string Out = &
C# 下base64加密解密实现
最新推荐文章于 2024-10-04 18:00:00 发布
这是一个C#编写的Base64加解密工具类,包括base64encode和base64decode方法,用于字符串的Base64编码和解码。同时,还包括utf16to8和utf8to16方法,用于UTF-16和UTF-8字符编码转换。
摘要由CSDN通过智能技术生成