![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 10 Pomógł: 0 Dołączył: 8.12.2006 Ostrzeżenie: (0%) ![]() ![]() |
Witam :-)
Interesuje mnie przerobienie ponizszej funkcji na kod php ![]() Jest mi to niezbedne do kilku operacji z protokolem gadu-gadu . Niestety nie wiem jak to ugryzc ,wiec moglby ktos pomoc ? Z gory dziekuje Kod w c (libgadu - common.c) : Kod int gg_http_hash(const char *format, ...) { unsigned int a, c, i, j; va_list ap; int b = -1; va_start(ap, format); for (j = 0; j < strlen(format); j++) { char *arg, buf[16]; if (format[j] == 'u') { snprintf(buf, sizeof(buf), "%d", va_arg(ap, uin_t)); arg = buf; } else { if (!(arg = va_arg(ap, char*))) arg = ""; } i = 0; while ((c = (unsigned char) arg[i++]) != 0) { a = (c ^ B) + (c << 8); b = (a >> 24) | (a << 8); } } va_end(ap); return (b < 0 ? -b : B); } [b]Kod w delphi (gglite.pas) :[/b] function TGGLite.HTTPHashCode (MultiParam: array of string):integer; var b,i,j:integer; var a,c:longword; begin result:=-1; if length(multiparam)=0 then exit; b:=-1; for i:=low(multiparam) to high(multiparam) do begin for j:=1 to length(multiparam[i]) do begin c:=ord(multiparam[i][j]); a:=(c xor B) + (c shl 8); b:=(a shr 24) or (a shl 8); end; end; if (b < 0) then result:=-b else result:=b; end; ~kwiateusz Używamy bbcode!! |
|
|
![]() ![]() |
![]() |
Aktualny czas: 20.08.2025 - 05:25 |