moze ktoś sprawdzic czy te dwa zapisy są równo znaczne :
(nieznam za dobrze C++ dlatego zalerzy mi na tym zeby mnie ktoś skorygował)
Obawiam się, że nie.
password: string
to nie to samo co
char *password
Wydaje mi się, że powinno być raczej
password: PChar;
Poza tym oczywiście nikt nie czyta tego postu na samej górze, jak pisać na forum... ;-(
c++:
[code]
int gg_login_hash(char *password, int seed)
{
unsigned int x, y, z;
y = seed;
for (x = 0; *password; password++) {
x = (x & 0xffffff00) | *password;
y ^= x;
y += x;
x <<= 8;
y ^= x;
x <<= 8;
y -= x;
x <<= 8;
y ^= x;
z = y & 0x1f;
y = (y << z) | (y >> (32 - z));
}
return y;
}
[/code]
i delphi :
[code]
function gg_login_hash(s:string;seed:integer):integer;
var x, y, z:Cardinal;
l:byte;
begin
y:= seed;
x:=0;
for l := 0 to length(s)-1 do
begin
x:=(x and 4294967030) or ord(s[l]);
y :=y xor x;
y :=y + x;
x :=x shl 8;
y :=y xor x;
x :=x shl 8;
y :=y - x;
x :=x shl 8;
y :=y xor x;
z := y and 31;
y := (y shl z) or (y shr (32 - z));
end;
gg_login_hash:=y;
end;
[/code]</quote>