use MD5; my $MAC = MD5->hexhash( $secret. MD5->hexhash(join '', $secret, @fields) );