C
Cloud0
Unregistered / Unconfirmed
GUEST, unregistred user!
function TForm1.EncryptionEngine(Srcchar; Keychar; AEdition: Integer)char;<br>var<br> KeyLen :Integer;<br> KeyPos :Integer;<br> offset :Integer;<br> dest :string; <br> SrcPos :Integer; <br> SrcAsc :Integer;<br> TmpSrcAsc :Integer; <br> Range :Integer;<br> keybak :string;<br> Srcbak :string; <br>begin<br> keybak:=key;<br> keybak := UpperCase(keybak);<br> Srcbak:=Src;<br> KeyLen:=Length(Keybak);<br> if KeyLen = 0 then keybak:='juezhan918';<br> KeyPos:=0;<br> Range:=256;<br> Randomize;<br> offset:=Random(Range);<br> dest:=format('%1.2x',[offset]);<br> for SrcPos := 1 to Length(Srcbak) do<br> begin<br> SrcAsc:=(Ord(Srcbak[SrcPos]) + offset) MOD 255;<br> if KeyPos < KeyLen then KeyPos:= KeyPos + 1 else KeyPos:=1;<br> SrcAsc:= SrcAsc xor Ord(Keybak[KeyPos]);<br> dest:=dest + format('%1.2x',[SrcAsc]);<br> offset:=SrcAsc;<br> end;<br> Result:=pchar(Dest);<br>end;