1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/crypto/weakcryptospi/test/tcryptospi/testdata/hashhmac/hmac_md4.pm Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,87 @@
1.4 +#
1.5 +# Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +# All rights reserved.
1.7 +# This component and the accompanying materials are made available
1.8 +# under the terms of the License "Eclipse Public License v1.0"
1.9 +# which accompanies this distribution, and is available
1.10 +# at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +#
1.12 +# Initial Contributors:
1.13 +# Nokia Corporation - initial contribution.
1.14 +#
1.15 +# Contributors:
1.16 +#
1.17 +# Description:
1.18 +#
1.19 +
1.20 +package Digest::HMAC_MD4;
1.21 +$VERSION="1.01";
1.22 +
1.23 +use strict;
1.24 +use Digest::MD4;
1.25 +use Digest::HMAC qw(hmac);
1.26 +
1.27 +# OO interface
1.28 +use vars qw(@ISA);
1.29 +@ISA=qw(Digest::HMAC);
1.30 +sub new
1.31 +{
1.32 + my $class = shift;
1.33 + $class->SUPER::new($_[0], "Digest::MD4", 64);
1.34 +}
1.35 +
1.36 +# Functional interface
1.37 +require Exporter;
1.38 +*import = \&Exporter::import;
1.39 +use vars qw(@EXPORT_OK);
1.40 +@EXPORT_OK=qw(hmac_md4 hmac_md4_hex);
1.41 +
1.42 +sub hmac_md4
1.43 +{
1.44 + hmac($_[0], $_[1], \&md4, 64);
1.45 +}
1.46 +
1.47 +sub hmac_md4_hex
1.48 +{
1.49 + unpack("H*", &hmac_md4)
1.50 +}
1.51 +
1.52 +1;
1.53 +
1.54 +__END__
1.55 +
1.56 +=head1 NAME
1.57 +
1.58 +Digest::HMAC_MD4 - Keyed-Hashing for Message Authentication
1.59 +
1.60 +=head1 SYNOPSIS
1.61 +
1.62 + # Functional style
1.63 + use Digest::HMAC_MD4 qw(hmac_md4 hmac_md4_hex);
1.64 + $digest = hmac_md4($data, $key);
1.65 + print hmac_md4_hex($data, $key);
1.66 +
1.67 + # OO style
1.68 + use Digest::HMAC_MD4;
1.69 + $hmac = Digest::HMAC_MD4->new($key);
1.70 +
1.71 + $hmac->add($data);
1.72 + $hmac->addfile(*FILE);
1.73 +
1.74 + $digest = $hmac->digest;
1.75 + $digest = $hmac->hexdigest;
1.76 + $digest = $hmac->b64digest;
1.77 +
1.78 +=head1 DESCRIPTION
1.79 +
1.80 +This module provide HMAC-MD4 hashing.
1.81 +
1.82 +=head1 SEE ALSO
1.83 +
1.84 +L<Digest::HMAC>, ,L<Digest::MD2>, L<Digest::MD5>, L<Digest::MD4>, L<Digest::HMAC_SHA1>
1.85 +
1.86 +=head1 AUTHOR
1.87 +
1.88 +Paul Sinfield, from Gisle Aas <gisle@aas.no>'s MD5 code
1.89 +
1.90 +=cut