Skip to content

Instantly share code, notes, and snippets.

@keedi
Created June 2, 2011 09:48
Show Gist options
  • Save keedi/1004187 to your computer and use it in GitHub Desktop.
Save keedi/1004187 to your computer and use it in GitHub Desktop.
like md5sum utility ;-)
#!/usr/bin/env perl
use 5.010;
use utf8;
use strict;
use warnings;
use Digest::MD5;
use File::Slurp;
say sprintf('%s %s', digest($_), $_) for @ARGV;
sub digest {
my $file = shift;
return unless -f $file;
my $data = read_file( $file );
my $ctx = Digest::MD5->new;
$ctx->add($data);
return $ctx->hexdigest;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment