NAME <filename>


Comput MD5 digest for <filename>.

This is a good replacement for 'md5sum'.


Copyright 2010 Etienne LEMEE <coding AT etilem DOT net>

This piece of code is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

#!/usr/bin/perl -w

use strict;
use Digest::MD5;

@ARGV > 0 or die << "USAGE";

usage: $0 <filename>

comput MD5 digest for <filename>

my $file = shift;
my $ctx = new Digest::MD5;

open my $FILE, '<', $file or die $!;

binmode $FILE;


printf "%s  %s\n", $ctx->hexdigest, $file;