日期:2014-05-18 浏览次数:20965 次
using System;
class Hex
{
private static string str_key;
static string decode(string str)
{
string str2 = str_key;
string str3 = "";
int num5 = 0;
if (str == "")
{
return "";
}
int length = str2.Length;
if (length == 0)
{
str2 = "Think Space";
}
int num2 = 0;
int num3 = Convert.ToInt32(str.Substring(0, 2), 0x10);
int startIndex = 2;
while (true)
{
try
{
num5 = Convert.ToInt32(str.Substring(startIndex, 2), 0x10);
}
catch (Exception)
{
}
int num6 = num5 ^ Convert.ToInt32(str2[num2]);
if (num6 <= num3)
{
num6 = (0xff + num6) - num3;
}
else
{
num6 -= num3;
}
str3 = str3 + Convert.ToChar(num6);
num3 = num5;
startIndex += 2;
if (num2 < length)
{
num2++;
}
else
{
num2 = 1;
}
if (startIndex >= str.Length)
{
return str3;
}
}
}
static void Main()
{
Console.WriteLine(decode("870098489"));
}
}