Skip to content

Commit 144ec14

Browse files
committed
Initialized return value of TDECHashAuthentication.PBKDF2
Set its length to 0
1 parent b08e417 commit 144ec14

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Source/DECHashAuthentication.pas

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,8 @@ TDECHashExtended = class(TDECHashAuthentication, IDECHashExtended)
510510
/// Number of bytes within the stream over which to calculate the hash value
511511
/// </param>
512512
/// <param name="HashResult">
513-
/// In this byte array the calculated hash value will be returned
513+
/// In this byte array the calculated hash value will be returned. The
514+
/// array will be automatically sized suitably.
514515
/// </param>
515516
/// <param name="OnProgress">
516517
/// Optional callback routine. It can be used to display the progress of
@@ -1237,6 +1238,7 @@ class function TDECHashAuthentication.PBKDF2(const Password, Salt: TBytes; Itera
12371238
InnerKeyPad, OuterKeyPad: TBytes;
12381239
SaltEx, T, U, TrimmedKey: TBytes;
12391240
begin
1241+
SetLength(Result, 0);
12401242
Hash := TDECHashAuthenticationClass(self).Create;
12411243
try
12421244
// Setup needed parameters
@@ -1330,7 +1332,7 @@ class function TDECHashAuthentication.PBKDF2(const Password, Salt: TBytes; Itera
13301332

13311333
class function TDECHashAuthentication.PBKDF2(const Password, Salt: RawByteString; Iterations: Integer; KeyLength: Integer): TBytes;
13321334
begin
1333-
result := PBKDF2(BytesOf(Password), BytesOf(Salt), Iterations, KeyLength);
1335+
Result := PBKDF2(BytesOf(Password), BytesOf(Salt), Iterations, KeyLength);
13341336
end;
13351337

13361338
{ TDECHashExtended }

0 commit comments

Comments
 (0)