sl@0: # sl@0: # Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: # All rights reserved. sl@0: # This component and the accompanying materials are made available sl@0: # under the terms of the License "Eclipse Public License v1.0" sl@0: # which accompanies this distribution, and is available sl@0: # at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: # sl@0: # Initial Contributors: sl@0: # Nokia Corporation - initial contribution. sl@0: # sl@0: # Contributors: sl@0: # sl@0: # Description: sl@0: # sl@0: sl@0: package Digest::HMAC_MD2; sl@0: $VERSION="1.01"; sl@0: sl@0: use strict; sl@0: use Digest::MD2 qw(md2); sl@0: use Digest::HMAC qw(hmac); sl@0: sl@0: # OO interface sl@0: use vars qw(@ISA); sl@0: @ISA=qw(Digest::HMAC); sl@0: sub new sl@0: { sl@0: my $class = shift; sl@0: $class->SUPER::new($_[0], "Digest::MD2", 16); sl@0: } sl@0: sl@0: # Functional interface sl@0: require Exporter; sl@0: *import = \&Exporter::import; sl@0: use vars qw(@EXPORT_OK); sl@0: @EXPORT_OK=qw(hmac_md2 hmac_md2_hex); sl@0: sl@0: sub hmac_md2 sl@0: { sl@0: hmac($_[0], $_[1], \&md2, 16); sl@0: } sl@0: sl@0: sub hmac_md2_hex sl@0: { sl@0: unpack("H*", &hmac_md2) sl@0: } sl@0: sl@0: 1; sl@0: sl@0: __END__ sl@0: sl@0: =head1 NAME sl@0: sl@0: Digest::HMAC_MD2 - Keyed-Hashing for Message Authentication sl@0: sl@0: =head1 SYNOPSIS sl@0: sl@0: # Functional style sl@0: use Digest::HMAC_MD2 qw(hmac_md2 hmac_md2_hex); sl@0: $digest = hmac_md2($data, $key); sl@0: print hmac_md2_hex($data, $key); sl@0: sl@0: # OO style sl@0: use Digest::HMAC_MD2; sl@0: $hmac = Digest::HMAC_MD2->new($key); sl@0: sl@0: $hmac->add($data); sl@0: $hmac->addfile(*FILE); sl@0: sl@0: $digest = $hmac->digest; sl@0: $digest = $hmac->hexdigest; sl@0: $digest = $hmac->b64digest; sl@0: sl@0: =head1 DESCRIPTION sl@0: sl@0: This module provide HMAC-MD2 hashing. sl@0: sl@0: =head1 SEE ALSO sl@0: sl@0: L, L, L sl@0: sl@0: =head1 AUTHOR sl@0: sl@0: Jon Thackray, from Gisle Aas 's MD5 code sl@0: sl@0: =cut