Alexandru <
alexandr...@meshparts.de> wrote:
> Hi,
>
> I have a C extension for Tcl that computes the checksum (md5 hash) of
> a given file.
>
> I just noticed, that for some files, the function returns the wrong
> value.
>
> I have a hunch, that I might be due to wrong eof sign or something
> similar.
First thing that sticks out at me:
fd = _wfopen(FileName,L"rb, ccs=UNICODE");
If the ccs=UNICODE overrides the "b" part, then there is your problem.
MD5 performs a checksum on the raw binary content of a file. You need
to read the raw binary untranslated bytes out and feed them into the
md5 algorithm.
No translations (eol, eof, utf-X, etc.) of anything should be
happening.