Thema: Delphi Pagerank bei Google

Einzelnen Beitrag anzeigen

bronco

Registriert seit: 11. Aug 2006
6 Beiträge
 
#6

Re: Pagerank bei Google

  Alt 13. Aug 2006, 16:53
WAO Danke Leute!!
Aber nur um zu zeigen das ich auch was versucht habe! und kein Schnorrer bin!
Das hatte ich als Newbee geschrieben ich glaube ihr seht sofort die Unterschiede!!
Delphi-Quellcode:
function zeroFill(a, b: integer): integer;

begin

  if (($80000000 and a)<> 0) then begin
     a := (a shr 1);
     a := a and (not $80000000);
     a := a or $40000000;
     a := (a shr (b-1));
     result := a;
     end
  else begin
     a := (a shr b);
     result := a;
   end;
 end;



function mix(a, b, c : integer): integer;

 begin
  a := (a - b);
  a := (a - c);
  a := (a xor (zeroFill(c,13)));
  b := (b - c);
  b := (b - a);
  b := (b xor (a shl 8));
  c := (c - a);
  c := (c - b);
  c := (c xor (zeroFill(b,13)));
  a := (a - b);
  a := (a - c);
  a := (a xor (zeroFill(c,12)));
  b := (b - c);
  b := (b - a);
  b := (b xor (a shl 16));
  c := (c - a);
  c := (c - b);
  c := (c xor (zeroFill(b,5)));
  a := (a - b);
  a := (a - c);
  a := (a xor (zeroFill(c,3)));
  b := (b - c);
  b := (b - a);
  b := (b xor (a shl 10));
  c := (c - a);
  c := (c - b);
  c := (c xor (zeroFill(b,15)));

  result := mix(a, b, c);
end;


function GCH(URL: array of byte): integer;
    const GMAG = '$0xE6359A60';
    var a, b, c, k, lengths, len : integer;
    var mix : array of integer;

   begin
    lengths := SizeOf(URL);
    a := StrToInt('$0x9E3779B9');
    b := a;
    c := StrToInt(GMAG);
    k := 0;
    len := lengths;

    while(len >= 12) do begin
        a := (a + (URL[k+0] + (URL[k+1]shl 8) + (URL[k+2]shl 16) + (URL[k+3]shl 24)));
        b := (b + (URL[k+4] + (URL[k+5]shl 8) + (URL[k+6]shl 16) + (URL[k+7]shl 24)));
        c := (c + (URL[k+8] + (URL[k+9]shl 8) + (URL[k+10]shl 16)+ (URL[k+11]shl 24)));
        mix := mix(a, b, c);
        a := mix[0];
        b := mix[1];
        c := mix[2];
        k := (k + 12);
        len := (len - 12);
    end;

    c := (c + lengths);
    case len of
        11: c := c + (URL[k+10] shl 24);
        10: c := c + (URL[k+9] shl 16);
        9 : c := c + (URL[k+8] shl 8);
        8 : b := b + (URL[k+7] shl 24);
        7 : b := b + (URL[k+6] shl 16);
        6 : b := b + (URL[k+5] shl 8);
        5 : b := b + (URL[k+4]);
        4 : a := a + (URL[k+3] shl 24);
        3 : a := a + (URL[k+2] shl 16);
        2 : a := a + (URL[k+1] shl 8);
        1 : a := a + (URL[k+0]);
      // case 0: nothing left to add
     end;
     mix := mix(a, b, c);
    result:= mix[2];
 end;
  Mit Zitat antworten Zitat