Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Konwersja kodu z delphi do php
kenobi13
post
Post #1





Grupa: Zarejestrowani
Postów: 32
Pomógł: 0
Dołączył: 13.07.2009
Skąd: Ziemia

Ostrzeżenie: (0%)
-----


Witam, czy ktos moze mi pomoc przekonwertowac kod z delphi na php? jest to funkcja do szyfrowania danych. Oto kod:
Kod
function StrToStrHash(Str, Key: String): String;
var
  i: Integer;
begin
  Result := '';

  for i := 1 to length(Key) do
    Result := Result + IntToBaseX(StrToHash(Str, i * ord(Key[i])), 62);
end;{StrToStrHash}

function StrToHash(Str: String; Method: Cardinal): Cardinal;
const
  Pow: array[0..7] of Integer = (1, 2, 4, 8, 16, 32, 64, 128);
var
  i, j, ByteVal: Integer;
  TestBit:       Boolean;
begin
  Result := 0;

  for i := 1 to length(Str) do
  begin
    ByteVal := ord(Str[i]);

    for j := 7 downto 0 do
    begin
      TestBit := ((Result and 32768) = 32768) xor ((ByteVal and Pow[j]) = Pow[j]);
      Result := ((Result and 32767) * 2);
      if TestBit then Result := Result xor Method;
    end;{for j}
  end;{for i}
end;{StrToHash}
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.08.2025 - 08:27