This forum is temporaily read-only. All existing discussions remain available for reference. For new questions, bug reports or support requests, please contact us at mail@lmdsupport.com.
Buffer in TCrMD5.MD5_Hash_Bytes too small
The buffer in the above function is too small.
The algorithm uses more then 64 extra bytes than the source-data:
procedure TCrMD5.MD5_Hash_Bytes;
const
cExtBuffer = 64+8;
...
begin
if FSourceLength + cExtBuffer < SizeOf(SttBuf) then
begin
...
end
else
begin
SetLength(DynBuf, FSourceLength + cExtBuffer);
...
end;
...
end;
BTW.
Isn't it better always use a dynamic array and remove the code which uses SttBuf: array[0..1024] of Byte?
The algorithm uses more then 64 extra bytes than the source-data:
procedure TCrMD5.MD5_Hash_Bytes;
const
cExtBuffer = 64+8;
...
begin
if FSourceLength + cExtBuffer < SizeOf(SttBuf) then
begin
...
end
else
begin
SetLength(DynBuf, FSourceLength + cExtBuffer);
...
end;
...
end;
BTW.
Isn't it better always use a dynamic array and remove the code which uses SttBuf: array[0..1024] of Byte?

Comments