| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 | unit EnctyptClientData;interfaceuses SysUtils;type  TScEnryptClient = class  public    function EncryptData(const AIP: string; AUser, AAction: Integer): string;    function DeEncryptData(const Value: string): string;  end;implementationuses Math;{ TScEnryptClient }function TScEnryptClient.DeEncryptData(const Value: string): string;begin  Result := Copy(Value, 4, Length(Value) - 5);end;function TScEnryptClient.EncryptData(const AIP: string; AUser,  AAction: Integer): string;var  I, iLen: Integer;  rav, slen: string;begin  Randomize;  SetLength(Result , 27);  rav := IntToStr(Random(10));  Result[1] := rav[1];  rav := IntToStr(Length(AIP));  if Length(rav) = 1 then  begin    Result[2] := '0';    Result[3] := rav[1];  end  else  begin    Result[2] := rav[1];    Result[3] := rav[2];  end;  rav := IntToStr(Random(10));  Result[4] := rav[1];  for I := 1 to Length(AIP) do  begin    Result[I + 4] := AIP[I];  end;    if Length(AIP) < 21 then  begin    iLen := Length(AIP);    while 16 - iLen > 0 do    begin      rav := IntToStr(Random(10));      Result[iLen + 5] := rav[1];      Inc(iLen);    end;  end;  rav := IntToStr(AUser);  slen := IntToStr(Length(rav));  if Length(rav) = 1 then  begin    Result[21] := '0';    Result[22] := rav[1];    Result[26] := '0';    Result[27] := slen[1];  end  else  begin    Result[21] := rav[1];    Result[22] := rav[2];    Result[26] := slen[1];    Result[27] := slen[2];  end; { Result[21] := rav[1];  rav := IntToStr(Random(10));  Result[22] := rav[1];  }  rav := IntToStr(AAction);  Result[23] := rav[1];  rav := IntToStr(Random(10));  Result[24] := rav[1];  rav := IntToStr(Random(10));  Result[25] := rav[1];end;end.
 |