How can I convert this XOR-encryption function from Delphi to C#? -
the following delphi routine long-ago compuserve posting, , used encrypt various information in our database. below both delphi 2007 , (thanks unicode differences) delphi xe versions. we have been trying convert c#, , have gotten close-ish, we're missing somewhere. unfortunately, our delphi guy (me) doesn't know c#, , c# guy new delphi. c# doesn't (appear to) have concept of ansistring, solution involve byte or char arrays? we'd appreciate in converting c#. delphi 2007 version (ascii) function encodedecode(str: string): string; const hash: string = '^%12hdvjed1~~#29afdmsd`6zvuy@hbkdbc3fn7y7euf|r7934093*7a-|- q`'; var i: integer; begin := 1 length (str) str[i] := chr (ord (str[i]) xor not (ord (hash[i mod length (hash) + 1]))); result := str; end; delphi xe version (unicode) function tfrmmain.encodedecode(str: ansistring): ansistring; const hash: string = '^%12hdvjed1~~#29afdmsd`6zvuy@hbkdbc3fn7y7euf|r7934093*7a-|- q`'; var...