c# encrypt

来源:互联网 发布:php 调用类的静态方法 编辑:程序博客网 时间:2024/04/28 22:50
 

给大家一个新的加密方法,C#的
using System;

/* The reason that i am using interface is that, in several
* weeks i will use a bitwise operator for have encryption and decryption
* */
public interface IBindesh
{
string encode(string str);
string decode(string str);
}

namespace EncryptionDecryption
{
/// <summary>
/// Summary description for EncryptionDecryption.
/// </summary>
public class EncryptionDecryption : IBindesh
{
public string encode(string str)
{
string htext = ""; // blank text

for ( int i = 0; i < str.Length; i++)
{
htext = htext + (char) (str[i] + 10 - 1 * 2);
}
return htext;
}

public string decode(string str)
{
string dtext = "";

for ( int i=0; i < str.Length; i++)
{
dtext = dtext + (char) (str[i] - 10 + 1*2);
}
return dtext;
}
}
}
====================================


作者Blog:http://blog.csdn.net/xjking0331/
原创粉丝点击