Einzelnen Beitrag anzeigen

Benutzerbild von Remko
Remko

Registriert seit: 10. Okt 2006
Ort: 's-Hertogenbosch, Die Niederlande
222 Beiträge
 
RAD-Studio 2010 Arc
 
#8

Re: Password hash in RDP files

  Alt 27. Mär 2007, 20:34
*push*
Any thoughts on improving this part:
Delphi-Quellcode:
{***********************************************************} 
{ PasswordHashToBlobData: Converts a RDP password Hash to   } 
{                         a DATA_BLOB structure             } 
{ sPasswordHash : RDP Password Hash (HEX String             } 
{***********************************************************} 
function PasswordHashToBlobData(sPasswordHash: string): DATA_BLOB;
var Buf: array of Byte;
  dwBufSize: Cardinal;
  i: Cardinal;
  j: Cardinal;
  dwHashSize: Cardinal;
begin
  dwBufSize := Length(sPassWordHash) DIV 2;
  dwHashSize := Length(sPasswordHash);
  SetLength(Buf, dwBufSize);

  i := 1;
  j := 0;
  while i < dwHashSize do begin
    Buf[j] := HexToByte(sPassWordHash[i] + sPassWordHash[i+1]);
    Inc(i, 2);
    Inc(j);
  end;

  GetMem(Result.pbData, dwBufSize);
  Result.cbData := dwBufSize;
  Result.pbData := PByte(Buf);
end;
BTW Functionally everything is working now, the hashed password also works after logout/login.
  Mit Zitat antworten Zitat