上面代码是c#代码,哪位仁兄能帮忙转成flax代码(主要是解密代码的转化)。求
下面代码是c#代码,哪位仁兄能帮忙转成flax代码(主要是解密代码的转化)。急求
//加密代码
public static string EncrypKey(string Src, string Key)
{
//int idx;
//Src = GB2312ToUTF8(Src);
if (Src == "")
{
return "";
}
int KeyLen;
int KeyPos;
int offset;
string Dest;
int SrcPos;
int SrcAsc;
int TmpSrcAsc;
//int Range;
KeyLen = Key.Length;
if (KeyLen == 0)
Key = "Think Space";
KeyPos = -1;
SrcPos = 0;
SrcAsc = 0;
//Range=256;
Random r = new Random(unchecked((int)DateTime.Now.Ticks));
offset = r.Next(0, 256);
Dest = offset.ToString("X02");
for (SrcPos = 0; SrcPos < Src.Length; SrcPos++)
{
SrcAsc = ((int)Src[SrcPos] + offset) % 255;
if (KeyPos < KeyLen - 1)
KeyPos = KeyPos + 1;
else
KeyPos = 0;
SrcAsc = SrcAsc ^ (int)Key[KeyPos];
Dest = Dest + SrcAsc.ToString("X02");
offset = SrcAsc;
//加密代码
public static string EncrypKey(string Src, string Key)
{
//int idx;
//Src = GB2312ToUTF8(Src);
if (Src == "")
{
return "";
}
int KeyLen;
int KeyPos;
int offset;
string Dest;
int SrcPos;
int SrcAsc;
int TmpSrcAsc;
//int Range;
KeyLen = Key.Length;
if (KeyLen == 0)
Key = "Think Space";
KeyPos = -1;
SrcPos = 0;
SrcAsc = 0;
//Range=256;
Random r = new Random(unchecked((int)DateTime.Now.Ticks));
offset = r.Next(0, 256);
Dest = offset.ToString("X02");
for (SrcPos = 0; SrcPos < Src.Length; SrcPos++)
{
SrcAsc = ((int)Src[SrcPos] + offset) % 255;
if (KeyPos < KeyLen - 1)
KeyPos = KeyPos + 1;
else
KeyPos = 0;
SrcAsc = SrcAsc ^ (int)Key[KeyPos];
Dest = Dest + SrcAsc.ToString("X02");
offset = SrcAsc;