os/security/crypto/weakcryptospi/test/tcryptospi/testdata/hashhmac/hmac_md4.pm
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 #
     2 # Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 # All rights reserved.
     4 # This component and the accompanying materials are made available
     5 # under the terms of the License "Eclipse Public License v1.0"
     6 # which accompanies this distribution, and is available
     7 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 #
     9 # Initial Contributors:
    10 # Nokia Corporation - initial contribution.
    11 #
    12 # Contributors:
    13 #
    14 # Description: 
    15 #
    16 
    17 package Digest::HMAC_MD4;
    18 $VERSION="1.01";
    19 
    20 use strict;
    21 use Digest::MD4;
    22 use Digest::HMAC qw(hmac);
    23 
    24 # OO interface
    25 use vars qw(@ISA);
    26 @ISA=qw(Digest::HMAC);
    27 sub new
    28 {
    29     my $class = shift;
    30     $class->SUPER::new($_[0], "Digest::MD4", 64);
    31 }
    32 
    33 # Functional interface
    34 require Exporter;
    35 *import = \&Exporter::import;
    36 use vars qw(@EXPORT_OK);
    37 @EXPORT_OK=qw(hmac_md4 hmac_md4_hex);
    38 
    39 sub hmac_md4
    40 {
    41     hmac($_[0], $_[1], \&md4, 64);
    42 }
    43 
    44 sub hmac_md4_hex
    45 {
    46     unpack("H*", &hmac_md4)
    47 }
    48 
    49 1;
    50 
    51 __END__
    52 
    53 =head1 NAME
    54 
    55 Digest::HMAC_MD4 - Keyed-Hashing for Message Authentication
    56 
    57 =head1 SYNOPSIS
    58 
    59  # Functional style
    60  use Digest::HMAC_MD4 qw(hmac_md4 hmac_md4_hex);
    61  $digest = hmac_md4($data, $key);
    62  print hmac_md4_hex($data, $key);
    63 
    64  # OO style
    65  use Digest::HMAC_MD4;
    66  $hmac = Digest::HMAC_MD4->new($key);
    67 
    68  $hmac->add($data);
    69  $hmac->addfile(*FILE);
    70 
    71  $digest = $hmac->digest;
    72  $digest = $hmac->hexdigest;
    73  $digest = $hmac->b64digest;
    74 
    75 =head1 DESCRIPTION
    76 
    77 This module provide HMAC-MD4 hashing.
    78 
    79 =head1 SEE ALSO
    80 
    81 L<Digest::HMAC>, ,L<Digest::MD2>, L<Digest::MD5>, L<Digest::MD4>, L<Digest::HMAC_SHA1>
    82 
    83 =head1 AUTHOR
    84 
    85 Paul Sinfield, from Gisle Aas <gisle@aas.no>'s MD5 code
    86 
    87 =cut