日期:2014-05-18 浏览次数:20538 次
int HARD_KEY = Convert.ToInt32("37", 16);
private string Encrypt(string sValue, string sKey)
{
string sTempValue = sValue;
string sTempKey = sKey.Trim();
string sRValue = "";
int sChar = 0;
for (int x = 1; x < sTempValue.Length; x++)
{
sChar = Convert.ToInt32(sTempValue.Substring(x, 1));
for (int y = 1; y < sTempKey.Length; y++)
{
int asc = Convert.ToInt32(sTempValue.Substring(y, 1));
sChar = asc | HARD_KEY;
}
sRValue = sRValue + Convert.ToChar(sChar).ToString();
}
listBox3.Items.Add(sRValue);
return sRValue;
}
------解决方案--------------------
循环x,y从0开始不行吗?
------解决方案--------------------
初步估计是这样子的,另外HARD_KEY的数据类型是啥
private string Encrypt(string sValue, string sKey)
{
//Dim intLen
string sRValue = string.Empty;
char sChar;
//sChar = 0
string sTempValue = sValue;
string sTempKey = sKey.Trim();
foreach (char x in sTempValue)
{
sChar = x;
foreach (char y in sTempKey)
{
int asc = Convert.ToInt32(y);
sChar = (char)asc | HARD_KEY;
}
sRValue = sRValue + sChar.ToString();
}
listBox3.Items.Add(sRValue);
return sRValue;
}