Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

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?

Comments

Sign In or Register to comment.