Skip to content

Instantly share code, notes, and snippets.

@lerry
Created September 30, 2012 07:23
Show Gist options
  • Save lerry/3806153 to your computer and use it in GitHub Desktop.
Save lerry/3806153 to your computer and use it in GitHub Desktop.
public string jiemi(string PlainStr, string key)
{
string str3;
int num2 = 1;
if ((Strings.Len(PlainStr) % 2) == 0)
{
string str4 = Strings.StrReverse(Strings.Left(PlainStr, (int) Math.Round((double) (((double) Strings.Len(PlainStr)) / 2.0))));
string str5 = Strings.StrReverse(Strings.Right(PlainStr, (int) Math.Round((double) (((double) Strings.Len(PlainStr)) / 2.0))));
PlainStr = str4 + str5;
}
int num3 = Strings.Len(PlainStr);
for (int i = 1; i <= num3; i++)
{
string str6 = Strings.Mid(PlainStr, i, 1);
string str2 = Strings.Mid(key, num2, 1);
if (((((Strings.Asc(str6) ^ Strings.Asc(str2)) < 0x20) | ((Strings.Asc(str6) ^ Strings.Asc(str2)) > 0x7e)) | (Strings.Asc(str6) < 0)) | (Strings.Asc(str6) > 0xff))
{
str3 = str3 + str6;
}
else
{
str3 = str3 + StringType.FromChar(Strings.Chr(Strings.Asc(str6) ^ Strings.Asc(str2)));
}
if (num2 == Strings.Len(key))
{
num2 = 0;
}
num2++;
}
return str3;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment