广告位,联系QQ:910488011
当前位置: 首页 > 文档下载 > QQ新加密代码【Delphi】
文档下载
QQ新加密代码【Delphi】
作者: admin  时间: 2012-06-22  点击: 7018

uses IdHash, IdHashMessageDigest;


function Fmd5(str:string):string;
var
md5 : TIdHashMessageDigest5;
longWordRec : T4x4LongWordRecord;
begin
md5 := TIdHashMessageDigest5.Create;
try
{$IFDEF ID10}
Result:= md5.HashStringAsHex(str);
{$ELSE}
longWordRec:= md5.HashValue(str);
Result:= md5.AsHex(longWordRec);
{$ENDIF}
finally
md5.Free;
end;
end;

 

function HashStr2BinStr(Hash:string):string;
var
buf:array[0..63] of Char;
i:Integer;
begin
Result:='';
FillChar(buf, SizeOf(buf),0);
SetLength(Result, Round(Length(Hash)/2));
FillChar(Result[1], Length(Result),0);
HexToBin(PChar(Hash), buf,SizeOf(buf));
for i:=0 to Round(Length(Hash)/2)-1 do
Result:= buf;
end;





function DealPASS(ptUin:string;Pass:string;Captcha:string):string; //处理密码
var
strptuin:string ;
i:integer;
begin


Result:= Fmd5(Pass);
Result:= HashStr2BinStr(Result);

ptUin:=StringReplace(ptUin,'\x','',[rfReplaceAll]); //去除\x

for i:=1 to (length(ptUin) div 2) do
begin
strptuin:=strptuin+char(strtoint('$'+copy(ptUin,i*2-1,2)));
end;


Result:= Fmd5(Result+strptuin);
Result:=Fmd5(Result+Captcha);


end;

 

 

调用 很简单

DealPASS('\x00\x00\x00\x00\x3c\xcb\x48\x45','密码','大写验证码')

返回加密字符串