Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: SHA1 calculations using Digest::SHA1 do not agree

by NetWallah (Canon)
on Nov 17, 2015 at 18:33 UTC ( [id://1147944]=note: print w/replies, xml ) Need Help??


in reply to SHA1 calculations using Digest::SHA1 do not agree

By default, the hexdigest will read the file in "OS Compatible" mode (as opposed to "portable" mode). This is made clear in the "--help" option of the "shasum" command, which is packaged with Digest::SHA1.

In my tests on Windows7, the shasum command with the "-p" option produced the same results as the default call to the hexdigest() method.

The "fciv" command, apparently reads the file in "binary" mode, which is also the default for the "shasum" command.

In order to be compatible, you will need to add "binmode $filehandle;" prior to the addfile() call, as Corion(++) has independently suggested above. I have tested this, and it works.

        “The sources of quotes found on the internet are not always reliable.” — Abraham Lincoln.3; cf.

  • Comment on Re: SHA1 calculations using Digest::SHA1 do not agree

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1147944]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-24 08:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found