See binmode.
In reply to Re: SHA1 calculations using Digest::SHA1 do not agree by Corion in thread SHA1 calculations using Digest::SHA1 do not agree by AdamtheKiwi