in reply to
Re^4: Digest::SHA gives different values for unix/windows
in thread Digest::SHA gives different values for unix/windows
Hi this is my first post.
Given that some OSes treat binary and text files differently (the latter messing around with line endings as you said in your first post), I think you really need a $mode argument to the Digest::SHA::addfile($filename [, $mode]) method.
Otherwise you'd have to do something like this to generate the hash of a file in binary mode:
open the file
while (not EOF)
read N-bytes of the file into a buffer # don't want to read the
+whole file into memory if it's a big file
It's easier to just call Digest::SHA::addfile($filename "b")
It might cause fewer problems if Digest::SHA::addfile() defaulted to binary mode.