#!/usr/local/bin/perl
use strict;
use Digest::DMAC qw(dmac hexdigest base64digest);
print "Enter key: ";
my $key = <STDIN>;
chomp $key;
print "Enter cipher: ";
my $cipher = <STDIN>;
chomp $cipher;
local $/ = undef;
while (<>) {
my $mac = dmac($key, $cipher, $_);
print hexdigest($mac), "\n";
}