using System;
using System.Collections.Generic;
using System.Text;
namespace CEncrypt
{
public class Encrypt
{
public Encrypt()
{ }
/**//// <summary>
/// 加密
/// </summary>
/// <param name="str">被加密字符</param>
/// <param name="level">加密强度</param>
/// <returns></returns>
public static string EncryptCode(string str,int level)
{
string temp = Convert.ToBase64String(Encoding.Default.GetBytes(str));
for (int i = 0; i < level; i++)
{
temp = Convert.ToBase64String(Encoding.Default.GetBytes(temp));
}
return temp;
}
/**//// <summary>
/// 加密
/// </summary>
/// <param name="str">被解密字符</param>
/// <param name="level">对应的加密强度</param>
/// <returns></returns>
public static string UnEncryptCode(string str,int level)
{
string temp = Encoding.Default.GetString(Convert.FromBase64String(str));
for (int i = 0; i < level; i++)
{
temp= Encoding.Default.GetString(Convert.FromBase64String(temp));
}
return temp;
}
}
}