sha256 problem encountered during 'make release'

Moritz Lenz moritz at
Thu Aug 18 12:12:51 UTC 2011

Am 18.08.2011 13:23, schrieb Lucian Branescu:
> On 18 August 2011 12:14, James E Keenan<jkeen at>  wrote:
>> In the course of preparing the 3.7 release, Coke++ reported being unable to
>> do 'make release' on Mac OS X due to the requirement to create sha256
>> checksums of the release tarballs.
>> I have been attempting to remedy this problem in the tar_shasum branch.  I
>> added entries for 'tar' and 'sha256sum' to init::defaults, then provided
>> OS-specific values to override the default (Linux) setting for 'sha256sum'
>> as I could find them for Darwin, FreeBSD and OpenBSD in their respective
>> init::hints::* packages.  (I could not locate ways to create sha256
>> checksums on NetBSD or DragonFlyBSD.  I have not yet explored how to do so
>> on Windows.)
>> (It's interesting that the utility suggested by dukeleto++ for Darwin,
>> 'shasum -a 256' is a command-line utility bundled with Darwin that is
>> actually implemented in Perl 5!)
>> Using the code in this branch, I have successfully run:
>>   perl  make relcheck
>> ... on Linux and Darwin, which constitute proof of the solution's validity.
>>   Coke, can you confirm this?
>> Also, can anyone provide the Windows equivalent?
> Afaik, windows comes with no tools whatsoever for doing checksums.
> Perhaps since perl is already required, a perl script could be written
> for that?

Indeed it can:

#!/usr/bin/env perl
use strict;
use warnings;

use Digest;

my ($cipher, @files) = @ARGV;
for (@files) {
     my $d = Digest->new('SHA-256');
     open my $f, '<:raw', $_ or die "Cannot open file '$_' for reading: $_";
     binmode $f;
     close $f;
     print $d->hexdigest, ' ', $_, "\n";

I timed it on a 50MB file, and compared it with the sha256 command line 
tool on my Debian box

$ time perl SHA-256 m2.sql.bz2
ab6813486f1c8d9d899666807e3cbd66d0dd36a7ac7816bb4cc1a0404da4657b m2.sql.bz2

real    0m0.519s
user    0m0.492s
sys     0m0.020s

$ time sha256sum  m2.sql.bz2
ab6813486f1c8d9d899666807e3cbd66d0dd36a7ac7816bb4cc1a0404da4657b  m2.sql.bz2

real    0m0.506s
user    0m0.492s
sys     0m0.012s

$ du -h m2.sql.bz2
50M     m2.sql.bz2

Since the difference is really small, I'd recommend just always using 
the Perl script (should work from perl 5.8.3 onwards, at least), instead 
of maintaining the code that decides which version to chose.


More information about the parrot-dev mailing list