Got an iPhone or iPad? We have a brand new Pastebin App for both devices, and it's totally free! Click here to download the new Pastebin App for iOS.
Guest

KKR_WE_RULE

By: a guest on Feb 4th, 2010  |  syntax: Delphi  |  size: 1.47 KB  |  hits: 99  |  expires: Never
download  |  raw  |  embed  |  report abuse
Copied
  1. Function Reverse(X : String):String;
  2. Var
  3.  len, i : Integer;
  4.  rev : String;
  5. Begin
  6.   len := length(x);
  7.   if len > 0 then
  8.   Begin
  9.     for i := len downto 1 do
  10.     Begin
  11.       rev := rev + x[i];
  12.     end;
  13.     result := rev;
  14.   end
  15.   else
  16.   Begin
  17.     exit;
  18.   end;
  19. End;
  20.  
  21. function GetCurrentComputerName: string;
  22. const
  23.   cnMaxUserNameLen = 254;
  24. var
  25.   sUserName     : string;
  26.   dwUserNameLen : dword;
  27. begin
  28.   dwUserNameLen := cnMaxUserNameLen-1;
  29.   SetLength(sUserName, cnMaxUserNameLen);
  30.   GetComputerName(PChar(sUserName), dwUserNameLen);
  31.   SetLength(sUserName, dwUserNameLen);
  32.   Result := sUserName;
  33. End;
  34.  
  35. procedure TForm1.Edit1Change(Sender: TObject);
  36. Var
  37.  name,serial,pc, Final : String;
  38.  i,nlen,plen,a,b,c,d,e,f,g ,nlength: Integer;
  39. begin
  40.   Name := edit1.Text;
  41.   nlen := Length(name);
  42.   pc   := GetCurrentComputerName;
  43.   plen := length(pc);
  44.   pc   := Reverse(pc);
  45.  
  46.   if nlen > 4 then
  47.   Begin
  48.   if (nlen < plen) then
  49.   Begin
  50.     pc := pc;
  51.   end
  52.   else
  53.   Begin
  54.   repeat
  55.     pc := pc + pc;
  56.   until
  57.   length(pc) >= nlen;  
  58.   end;
  59.  
  60.  
  61.   a := 0; b := 0; c := 0; d := 0; e := 0; f := 0; g := 0;
  62.  
  63.   for i := 1 to nlen do
  64.   Begin
  65.     a := ord(name[i]);
  66.     b := a;
  67.     c := a + b;
  68.     d := a + c;
  69.     e := d shl 2;
  70.     e := e shr 1;
  71.     e := e shr 1;
  72.     e := e shr 1;
  73.     f := f + e;
  74.     g := ord(pc[i]);
  75.     f := g + f;
  76.   end;
  77.   edit2.Text := IntToSTr(f);
  78.   end
  79.   else
  80.   Begin
  81.     edit2.Text := 'Need more chars ..';
  82.     exit;
  83.   end;
  84. end;