internal class Encode
{
public static string simple_decode(string outputStr)
{
int[] numArray = new int[] {
2, 3, 5, 8, 13, 0x15, 0x22, 0x37, 0x59, 0x90, 0xe9, 0x179, 610, 0x3db, 0x63d, 0xa18,
0x1055, 0x1a6d, 0x2ac2, 0x452f
};
int startIndex = 0;
string str2 = "";
while (startIndex < outputStr.Length)
{
int num5 = 0;
int num2 = string2ascii(outputStr.Substring(startIndex, 2));
startIndex += 2;
int num3 = string2ascii(outputStr.Substring(startIndex, 2));
int num4 = numArray[(startIndex / 4) % 20] * 0x61;
num5 = ((num3 * 0xff) + num2) - num4;
str2 = str2 + Convert.ToChar(num5).ToString();
startIndex += 2;
}
return str2;
}
public static string simple_encode(string inputStr)
{
ASCIIEncoding encoding = new ASCIIEncoding();
int[] numArray = new int[] {
2, 3, 5, 8, 13, 0x15, 0x22, 0x37, 0x59, 0x90, 0xe9, 0x179, 610, 0x3db, 0x63d, 0xa18,
0x1055, 0x1a6d, 0x2ac2, 0x452f
};
int index = 0;
string str = "";
for (index = 0; index < inputStr.Length; index++)
{
int num4 = numArray[index] * 0x61;
int num5 = encoding.GetBytes(inputStr.Substring(index, 1))[0];
num5 += num4;
int num2 = num5 / 0xff;
int num3 = num5 % 0xff;
num4 = num3 / 0x10;
str = str + num4.ToString("X");
num4 = num3 - ((num3 / 0x10) * 0x10);
str = str + num4.ToString("X");
num4 = num2 / 0x10;
str = str + num4.ToString("X");
str = str + ((num2 - ((num2 / 0x10) * 0x10))).ToString("X");
}
return str;
}
public static byte string2ascii(string iter_ch)
{
if (iter_ch.Length != 2)
{
return 0;
}
byte num = 0;
char ch = iter_ch[0];
switch (iter_ch[1])
{
case '0':
num = num;
break;
case '1':
num = (byte) (num + 1);
break;
case '2':
num = (byte) (num + 2);
break;
case '3':
num = (byte) (num + 3);
break;
case '4':
num = (byte) (num + 4);
break;
case '5':
num = (byte) (num + 5);
break;
case '6':
num = (byte) (num + 6);
break;
case '7':
num = (byte) (num + 7);
break;
case '8':
num = (byte) (num + 8);
break;
case '9':
num = (byte) (num + 9);
break;
case 'A':
num = (byte) (num + 10);
break;
case 'B':
num = (byte) (num + 11);
break;
case 'C':
num = (byte) (num + 12);
break;
case 'D':
num = (byte) (num + 13);
break;
case 'E':
num = (byte) (num + 14);
break;
case 'F':
num = (byte) (num + 15);
break;
}
switch (ch)
{
case '0':
return num;
case '1':
return (byte) (num + 0x10);
case '2':
return (byte) (num + 0x20);
case '3':
return (byte) (num + 0x30);
case '4':
return (byte) (num + 0x40);
case '5':
return (byte) (num + 80);
case '6':
return (byte) (num + 0x60);
case '7':
return (byte) (num + 0x70);
case '8':
return (byte) (num + 0x80);
case '9':
return (byte) (num + 0x90);
case 'A':
return (byte) (num + 160);
case 'B':
return (byte) (num + 0xb0);
case 'C':
return (byte) (num + 0xc0);
case 'D':
return (byte) (num + 0xd0);
case 'E':
return (byte) (num + 0xe0);
case 'F':
return (byte) (num + 240);
}
return num;
}
}
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)