打印

[讨论] 一种C#的加密方法代码

一种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 + 10 - 1 * 2);
}
return htext;
}
public string decode(string str)
{
string dtext = "";
for ( int i=0; i < str.Length; i++)
{
dtext = dtext + (char) (str - 10 + 1*2);
}
return dtext;
}
}
}
世事无常亦如此,我心欲绝随风去!

TOP

。。。o(∩_∩)o 。。。。


还不错。。。
该代码提供了一个简单算术加密与解密。。。。
大家可以在加密算法上自由发挥数学才能。。。。
这种自定义的加密方式蛮酷的。。。。(比如说:死党之间的信书来往)
有兴趣的话可以查找相关资料拓展一下。。。。。
偶下学期就要学习“密码学”的相关知识了,期待中。。。
。。。o(∩_∩)o 。。。。

TOP

我觉得这个很简单,只要把它的ASSIIC码的值加减处理就可以了,我是这么认为的,呵呵

TOP

C#,不懂,密码学,不是很了解,俺要学的还很多啊~

TOP

for ( int i=0; i < str.Length; i++)
{
dtext = dtext + (char) (str - 10 + 1*2);
}
//以上是加密核心代码:
-----------------------
key=dtext  + 10 -2

//解密代码

TOP

Processed in 0.296273 second(s), 5 queries, Gzip enabled.