Created
June 2, 2011 09:48
-
-
Save keedi/1004187 to your computer and use it in GitHub Desktop.
like md5sum utility ;-)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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