uTPLb_Random
单元、TRandomStream.Randomize
方法中出现打字错误。现在它已修复(参见GitHub 上的 uTPLb_Random.pas)。
procedure TRandomStream.Randomize();
{$IFDEF SMWINDOWS} //Should be MSWINDOWS
var
hProv: THandle;
dwProvType, dwFlags: DWORD;
Provider1: string;
hasOpenHandle: boolean;
{$ENDIF}
begin
{$IFDEF SMWINDOWS} //Should be MSWINDOWS
Provider1 := Provider;
dwProvType := PROV_RSA_FULL;
dwFlags := CRYPT_SILENT;
hasOpenHandle := CryptAcquireContext(hProv, nil, PChar(Provider), dwProvType, dwFlags);
try
if (not hasOpenHandle) or (not CryptGenRandom(hProv, SizeOf(FValue), @FValue)) then
FValue := TimeStampClock();
finally
if hasOpenHandle then
CryptReleaseContext(hProv, 0);
end;
Crunch();
{$ENDIF}
end;
更正后,它每次都会生成不同的密钥。