日期:2014-05-19  浏览次数:20723 次

求一种字符串字密的方法
希望在Delphi和C#里加密后的值是一致的.求教高手.

不需要特别复杂的.

普通的加密就行.然后Delphi和C#中的值一致就可以了.

------解决方案--------------------
using System;

public interface IBindesh
{
string encode(string str);
string decode(string str);
}

namespace EncryptionDecryption
{
/// <summary>
/// 加密解密
/// </summary>
public class EncryptionDecryption : IBindesh
{
public string encode(string str)
{
string htext = " ";

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;
}
}

public class test
{
public static void aa()
{
EncryptionDecryption inter = new EncryptionDecryption();
Console.WriteLine(((IBindesh)inter).encode( "aa "));
System.Console.ReadLine();
}
}
}这个就可以实现加密解密.你再改一下