Q
qq87761357
Unregistered / Unconfirmed
GUEST, unregistred user!
//BASE64函数function Base64(Src: string): string;const DataSet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';var i, ModLen: integer; Current: string; Buf: array[1..3] of Byte; NewBuf: array[1..4] of Byte;begin result := ''; if Src = '' then exit; ModLen := Length(Src) mod 3; while Length(Src) > 0 do begin FillChar(Buf, 3, #0); Current := Copy(Src, 1, 3); Src := Copy(Src, 4, Length(Src) - 3); for i := 1 to 3 do Buf := Ord(Current); NewBuf[1] := Buf[1] shr 2; NewBuf[2] := (Buf[1] shl 6 shr 2 or Buf[2] shr 4) and $3F; NewBuf[3] := (Buf[2] shl 4 shr 2 or Buf[3] shr 6) and $3F; NewBuf[4] := Buf[3] and $3F; for i := 1 to 4 do result := result + DataSet[NewBuf + 1]; end; if ModLen >= 1 then result[Length(result)] := '='; if ModLen = 1 then result[Length(result) - 1] := '=';end;//得到登陆字符串的函数function GetCommandLine(QQNum, QQPw: string; QQState: integer): string;type TempChar = array[0..15] of char;var md5: TIdHashMessageDigest5;begin md5 := TIdHashMessageDigest5.Create; result := ' /START QQUIN:' + QQNum + ' PWDHASH:' + Base64(TempChar(md5.HashValue(QQPw))) + ' /STAT:' + IntToStr(QQState); md5.Free; //40隐身登陆 41正常登陆 end;procedure TForm1.Button1Click(Sender: TObject);begin if opendialog1.Execute then edit1.text:=opendialog1.FileName;end;procedure TForm1.Button2Click(Sender: TObject);begin winexec(pchar(edit1.text+' '+GetCommandLine(edit2.text,edit3.text,40)),sw_normal); //执行登陆字符串end;end.能帮我解释清楚所有代码的意思吗,尤其是以下代码请高手指教为什么这么写for i := 1 to 4 do result := result + DataSet[NewBuf + 1]; end; if ModLen >= 1 then result[Length(result)] := '='; if ModLen = 1 then result[Length(result) - 1] := '=';