都说QQ登陆器可以防止QQ密码被盗,网上下的,担心有后门,这里自己写个QQ登陆器,关键代码如下:
// 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[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 getmpass(qqpws:string):string ;
type
md5x = array[0..15] of char;
var
md5: TIdHashMessageDigest5;
begin
md5 := TIdHashMessageDigest5.Create;
result:=Base64(md5x(md5.HashValue(QQPws))) ;
md5.Free;
end;
//登陆按钮的单击事件
procedure TForm1.Button1Click(Sender: TObject);
var qqdl,qqdl1:string;
begin
QQNum:=edit2.text;
QQPw:=getmpass(edit3.Text);
qqdl:= ' /START QQUIN:' + edit2.text + ' PWDHASH:' +QQPw + ' /STAT:41';
qqdl1:= ' /START QQUIN:' + edit2.text + ' PWDHASH:' +QQPw + ' /STAT:40';
if checkbox1.Checked then
Winexec(pchar(edit1.text+qqdl1),5) else
Winexec(pchar(edit1.text+qqdl),5)
end;
运行效果:
http://www.xuedelphi.cn/wenzhang/yytg/2007/12/200712231969.htm