Ansel's Blog

It would probably render the application more complex

博客园 首页 新随笔 联系 订阅 管理
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;
}

}

}

 
posted on 2005-04-08 12:32  Ansel  阅读(973)  评论(3编辑  收藏  举报