cloudflight
2024-11-30 83d116f68aa4e9e93f982d23f23a7a46680cd169
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
26
27
28
29
30
31
32
33
namespace Yw.BIMFace
{
    /// <summary>
    /// base64格式转换器
    /// </summary>
    public static class Base64Extension
    {
        /// <summary>
        ///  使用 UTF8 编码格式,对字符串进行进行 Base64 方式编码(加密)
        /// </summary>
        /// <param name="this">扩展对象</param>
        /// <returns>编码后的字符串</returns>
        public static string EncryptByBase64(this string @this)
        {
            byte[] bytes = Encoding.Default.GetBytes(@this);
            return Convert.ToBase64String(bytes);
        }
 
        /// <summary>
        ///  使用 UTF8 编码格式,对字符串进行进行 Base64 方式解码(解密)
        /// </summary>
        /// <param name="this">扩展对象</param>
        /// <returns>解码后的字符串</returns>
        public static string DecryptByBase64(this string @this)
        {
            byte[] bytes = Convert.FromBase64String(@this);
            return Encoding.Default.GetString(bytes);
        }
 
 
 
    }
}