refacts
parent
5f0dfee768
commit
ae114c68db
@ -0,0 +1,34 @@
|
|||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace isn
|
||||||
|
{
|
||||||
|
internal interface IDataProtector
|
||||||
|
{
|
||||||
|
string Protect(string data);
|
||||||
|
string UnProtect(string data);
|
||||||
|
}
|
||||||
|
class DefaultDataProtector : IDataProtector
|
||||||
|
{
|
||||||
|
public string Protect(string data)
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
foreach (char c in data)
|
||||||
|
{
|
||||||
|
sb.Append(c+13);
|
||||||
|
}
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public string UnProtect(string data)
|
||||||
|
{
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
foreach (char c in data)
|
||||||
|
{
|
||||||
|
sb.Append(c-13);
|
||||||
|
}
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue