请把下列delphi加密解密代码转化为c#
function TForm_Login.jmPass(str: string): string;
var
m,str1: string;
asc,asc1: byte;
i: integer;
begin
m := '\iklop;lk,kjjhh\ ';
for i:=1 to length(str) do
begin
asc := ord(str[i]);
asc := asc and $F;
asc1 := ord(m[i]);
asc1 := asc1 and $F;
asc1 := asc xor asc1;
asc := ord(str[i]);
asc := asc and $F0;
asc := asc + asc1;
str1 := str1 + chr(asc);
end;
result := str1;
end;
($F是二进制前四位改为0000)
------解决方案--------------------这个代码没有这样麻烦,这样写
Delphi(Pascal) code
function jmPass1(str: string): string;
var
m: string;
I: Integer;
begin
m := '\iklop;lk,kjjhh\ ';
for I := 1 to Length(str) do
Result := Result + Chr((Ord(str[i]) and $F0) or
(Ord(str[i]) and $F) xor (ord(m[i]) and $F));
end;