C# base64加密解密

2021-03-04 03:27

阅读:310

标签:decode   odi   编码   ram   param   string   public   turn   sum   


    ///


    /// 实现Base64加密解密
    ///

    public sealed class Base64
    {
       
        ///
        /// BASE64编码加密
        ///

        ///
        ///
        ///
        public static string Base64Encode(string s, string encode)
        {
            return Convert.ToBase64String(Encoding.GetEncoding(encode).GetBytes(s));
        }

        ///
        /// BASE64编码解密
        ///

        ///
        ///
        ///
        public static string Base64Decode(string s, string encode)
        {
            return Encoding.GetEncoding(encode).GetString(Convert.FromBase64String(s));
        }

}

注:encode传utf-8,s传需加密的值

C# base64加密解密

标签:decode   odi   编码   ram   param   string   public   turn   sum   

原文地址:https://www.cnblogs.com/tfeblog/p/12956022.html


评论


亲,登录后才可以留言!