File Coverage

blib/lib/Digest/MD4.pm
Criterion Covered Total %
statement 6 14 42.8
branch 0 2 0.0
condition n/a
subroutine 2 4 50.0
pod 0 2 0.0
total 8 22 36.3


line stmt bran cond sub pod time code
1             package Digest::MD4;
2              
3 6     6   6760 use strict;
  6         6899  
  6         327  
4 6     6   42 use vars qw($VERSION @ISA @EXPORT_OK);
  6         10  
  6         3648  
5              
6             $VERSION = '1.9'; # ActivePerl version adds hexhash() for compatibility
7              
8             require Exporter;
9             *import = \&Exporter::import;
10             @EXPORT_OK = qw(md4 md4_hex md4_base64);
11              
12             require DynaLoader;
13             @ISA=qw(DynaLoader);
14              
15             eval {
16             Digest::MD4->bootstrap($VERSION);
17             };
18             if ($@) {
19             my $olderr = $@;
20             eval {
21             # Try to load the pure perl version
22             require Digest::Perl::MD4;
23              
24             Digest::Perl::MD4->import(qw(md4 md4_hex md4_base64));
25             push(@ISA, "Digest::Perl::MD4"); # make OO interface work
26             };
27             if ($@) {
28             # restore the original error
29             die $olderr;
30             }
31             }
32             else {
33             *reset = \&new;
34             }
35             # hash() and hexhash() was in Digest::MD4 1.1. Deprecated
36             sub hash {
37 0     0 0   my ($self, $data) = @_;
38 0 0         if (ref($self))
39             {
40             # This is an instance method call so reset the current context
41 0           $self->reset();
42             }
43             else
44             {
45             # This is a static method invocation, create a temporary MD4 context
46 0           $self = new Digest::MD4;
47             }
48            
49             # Now do the hash
50 0           $self->add($data);
51 0           $self->digest();
52             }
53              
54             sub hexhash
55             {
56 0     0 0   my ($self, $data) = @_;
57              
58 0           unpack("H*", ($self->hash($data)));
59             }
60              
61             1;
62             __END__