c# encrypt
2004-11-18 14:26
459 查看
给大家一个新的加密方法,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/
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/
相关文章推荐
- C#写的email 初级系统源代码
- c#下重写BUTTON控件
- C#:ListBox的2个常用方法Add,Clear与Items的2个属性
- C#中字符串的格式化及转换成数值的方法
- C#实现大文件分块发送到客户端
- C#控制摄像头拍照
- 在windows中以#结尾了文件夹问题
- C#实现的18位身份证格式验证算法
- C# 编码规范和编程好习惯
- 由C#风潮想起的——给初学编程者的忠告
- 反射技术与工厂方法 (using C#)
- C#中字符串的格式化及转换成数值的方法
- C#:获得文件版本信息及只读文件的删除
- C#实现的18位身份证格式验证算法[转载]
- C#:文件的按行读/写及文件目录的操作
- C#:ListBox的2个常用方法Add,Clear与Items的2个属性
- 接口继承的声明问题 [C#, BCL]
- 接口继承的声明问题 [C#, BCL]
- C# 读写注册表
- 如何把string解析为int?[C#]