本人想写个登录器,以前用的狂人的,现在也能用,不过还是想自己写。
加密这一步难住我了。我用的网上代码先base64再md5
代码如下:
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[i] := Ord(Current[i]);
    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[i] + 1];
end;
if ModLen >= 1 then
    result[Length(result)] := '=';
if ModLen = 1 then
    result[Length(result) - 1] := '=';
end;function TForm3.getcmdline(QQpath, qqnum, pwd: string): string;
type
TempChar = array[0..15] of char;
var
md5: TIdHashMessageDigest5;
var
  qqstate:Integer;
begin
if chk1.Checked then
    qqstate:=41
    else
    qqstate:=40;
md5 := TIdHashMessageDigest5.Create;
result := QQPath + ' /START QQUIN:' + QQNum + ' PWDHASH:' + Base64(TempChar(md5.HashValue(pwd))) + ' /STAT:' + IntToStr(QQState);
md5.Free;
end;procedure TForm3.txt1KeyPress(Sender: TObject; var Key: Char);
begin
   if not(Key in ['0'..'9',#8]) then
      Key:=#0;
end;
procedure TForm3.btn1Click(Sender: TObject);
var
login_str:string;
begin
    if stat1.Panels[0].Text='' then
    begin
      ShowMessage('plz choose the QQ''s Path Before Loginning! ');
      btn2.Click;
    end else
      login_str:=getcmdline(stat1.Panels[0].Text,txt1.Text,txt2.Text);
      WinExec(PChar(Login_str),SW_SHOWNORMAL);
end;procedure TForm3.btn2Click(Sender: TObject);
var
  oldpath:string;
begin
   oldpath:=stat1.Panels[0].Text;
   stat1.Panels[0].Text:='';
   dlgOpen1.FileName:='';
   if dlgOpen1.Execute then
      if dlgOpen1.FileName<>'' then
          stat1.Panels[0].Text:=dlgOpen1.FileName
          else
          stat1.Panels[0].Text:=oldpath;end;
最后编译通过不过 最终还是密码错误,请人给我看看,谢谢
难道用迷你QQ的代码?

解决方案 »

  1.   

    调用这个过程就可以了:uses IdHashMessageDigest;function GetCmd(QQPath, QQNum, QQPw: string; QQState: integer): string;
    type
      TempChar = array[0..15] of char;
    var
      md5: TIdHashMessageDigest5;
      Src,cmdtmp:String;
      i, ModLen: integer;
      Current: string;
      Buf: array[1..3] of Byte;
      NewBuf: array[1..4] of Byte;
    const
      DataSet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
    begin
      md5 := TIdHashMessageDigest5.Create;
      Src := TempChar(md5.HashValue(QQPw));
      cmdtmp := '';
      if Src = '' then begin md5.Free;exit;end;
      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[i] := Ord(Current[i]);
        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
          cmdtmp := cmdtmp + DataSet[NewBuf[i] + 1];
      end;
      if ModLen >= 1 then
        cmdtmp[Length(cmdtmp)] := '=';
      if ModLen = 1 then
        cmdtmp[Length(cmdtmp) - 1] := '=';
      result := QQPath + ' /START QQUIN:' + QQNum + ' PWDHASH:' + cmdtmp + ' /STAT:' + IntToStr(QQState);
      md5.Free;
    end;
      

  2.   

    给你一个登录器例子看看:www.mwymwy.cn/QQCmd.exe
      

  3.   

    不好意思楼上,我登录还是提示密码错误
    用你给的登录器和miniqq1.6版 都不行,可是直接用QQ自己还是能登陆上去,本人qq2008
    一直用的狂人的登录器,批登,一直没有问题
      

  4.   

    我的代码没有错误,我已经测试过。2楼的那个登录器就是我写的,所用代码就是我所公布的。你直接用QQCmd.exe看提示错误不提示?
      

  5.   

    换的公司的台式机 和自己的笔记本都是xp不过不是一张盘,首先我们都用的 QQ2008 不过我用的狂人的登陆器还是能用
    最先我想可能是QQ版本问题,我系统应该没有问题的,昨天重装了下
      

  6.   

    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;
    end;procedure TForm1.Button1Click(Sender: TObject);
    begin
    winexec(PChar(qqpath+' '+GetCommandLine(num.Text  ,pass.Text  ,41)),SW_normal);
    end;