Android Question simple crypter without use library

frankly

Member
Licensed User
Longtime User
can anyone help in converting to b4a?


skey:= 'ABCD1234';




function decrypter(Src: string): string;
var
KeyLen: Integer;
KeyPos: Integer;
OffSet: Integer;
Dest: string;
SrcPos: Integer;
SrcAsc: Integer;
TmpSrcAsc: Integer;
Range: Integer;
begin
if (Src = '') then
begin
Result := '';
exit;
end;
Dest := '';
KeyLen := Length(skey);
KeyPos := 0;
OffSet := StrToInt('$' + copy(Src, 1, 2));
SrcPos := 3;
repeat
SrcAsc := StrToInt('$' + copy(Src, SrcPos, 2));
if (KeyPos < KeyLen) then KeyPos := KeyPos + 1 else KeyPos := 1;
TmpSrcAsc := SrcAsc xor Ord(skey[KeyPos]);
if TmpSrcAsc <= OffSet then TmpSrcAsc := 255 + TmpSrcAsc - OffSet
else TmpSrcAsc := TmpSrcAsc - OffSet;
Dest := Dest + Chr(TmpSrcAsc);
OffSet := SrcAsc;
SrcPos := SrcPos + 2;
until (SrcPos >= Length(Src));
Result := Dest;
end;
 
Last edited:
Top