"Fossies" - the Fresh Open Source Software Archive

Member "Digest-HMAC-1.04/lib/Digest/HMAC_MD5.pm" (1 Apr 2021, 1240 Bytes) of package /linux/privat/Digest-HMAC-1.04.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 package Digest::HMAC_MD5;
    2 our $VERSION = '1.04'; # VERSION
    3 our $AUTHORITY = 'cpan:ARODLAND'; # AUTHORITY
    4 
    5 use strict;
    6 use Digest::MD5  qw(md5);
    7 use Digest::HMAC qw(hmac);
    8 
    9 # OO interface
   10 use vars qw(@ISA);
   11 @ISA=qw(Digest::HMAC);
   12 sub new
   13 {
   14     my $class = shift;
   15     $class->SUPER::new($_[0], "Digest::MD5", 64);
   16 }
   17 
   18 # Functional interface
   19 require Exporter;
   20 *import = \&Exporter::import;
   21 use vars qw(@EXPORT_OK);
   22 @EXPORT_OK=qw(hmac_md5 hmac_md5_hex);
   23 
   24 sub hmac_md5
   25 {
   26     hmac($_[0], $_[1], \&md5, 64);
   27 }
   28 
   29 sub hmac_md5_hex
   30 {
   31     unpack("H*", &hmac_md5)
   32 }
   33 
   34 1;
   35 
   36 __END__
   37 
   38 =head1 NAME
   39 
   40 Digest::HMAC_MD5 - Keyed-Hashing for Message Authentication
   41 
   42 =head1 SYNOPSIS
   43 
   44  # Functional style
   45  use Digest::HMAC_MD5 qw(hmac_md5 hmac_md5_hex);
   46  $digest = hmac_md5($data, $key);
   47  print hmac_md5_hex($data, $key);
   48 
   49  # OO style
   50  use Digest::HMAC_MD5;
   51  $hmac = Digest::HMAC_MD5->new($key);
   52 
   53  $hmac->add($data);
   54  $hmac->addfile(*FILE);
   55 
   56  $digest = $hmac->digest;
   57  $digest = $hmac->hexdigest;
   58  $digest = $hmac->b64digest;
   59 
   60 =head1 DESCRIPTION
   61 
   62 This module provide HMAC-MD5 hashing.
   63 
   64 =head1 SEE ALSO
   65 
   66 L<Digest::HMAC>, L<Digest::MD5>, L<Digest::HMAC_SHA1>
   67 
   68 =head1 MAINTAINER
   69 
   70 Andrew Rodland <arodland@cpan.org>
   71 
   72 =head1 ORIGINAL AUTHOR
   73 
   74 Gisle Aas <gisle@aas.no>
   75 
   76 =cut