| 1 | package Digest::MD4; | ||||||||||
| 2 | |||||||||||
| 3 | 6 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 6 | ▶ | use vars qw($VERSION @ISA @EXPORT_OK); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 6 | $VERSION = '1.9'; # ActivePerl version adds hexhash() for compatibility | |||||||||
| 7 | |||||||||||
| 8 | 6 | require Exporter; | |||||||||
| 9 | 6 | *import = \&Exporter::import; | |||||||||
| 10 | 6 | @EXPORT_OK = qw(md4 md4_hex md4_base64); | |||||||||
| 11 | |||||||||||
| 12 | 6 | require DynaLoader; | |||||||||
| 13 | 6 | @ISA=qw(DynaLoader); | |||||||||
| 14 | |||||||||||
| 15 | 6 | eval { | |||||||||
| 16 | 6 | Digest::MD4->bootstrap($VERSION); | |||||||||
| 17 | }; | ||||||||||
| 18 | 6 | ▶ | if ($@) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 19 | 0 | my $olderr = $@; | |||||||||
| 20 | 0 | eval { | |||||||||
| 21 | # Try to load the pure perl version | ||||||||||
| 22 | 0 | require Digest::Perl::MD4; | |||||||||
| 23 | |||||||||||
| 24 | 0 | Digest::Perl::MD4->import(qw(md4 md4_hex md4_base64)); | |||||||||
| 25 | 0 | push(@ISA, "Digest::Perl::MD4"); # make OO interface work | |||||||||
| 26 | }; | ||||||||||
| 27 | 0 | ▶ | if ($@) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | # restore the original error | ||||||||||
| 29 | 0 | die $olderr; | |||||||||
| 30 | } | ||||||||||
| 31 | } | ||||||||||
| 32 | else { | ||||||||||
| 33 | 6 | *reset = \&new; | |||||||||
| 34 | } | ||||||||||
| 35 | # hash() and hexhash() was in Digest::MD4 1.1. Deprecated | ||||||||||
| 36 | 0 | ▶ | sub hash { | ||||||||
|
Subroutine
hash: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 37 | 0 | my ($self, $data) = @_; | |||||||||
| 38 | 0 | ▶ | if (ref($self)) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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 | 0 | ▶ | { | ||||||||
|
Subroutine
hexhash: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 56 | 0 | my ($self, $data) = @_; | |||||||||
| 57 | |||||||||||
| 58 | 0 | unpack("H*", ($self->hash($data))); | |||||||||
| 59 | } | ||||||||||
| 60 | |||||||||||
| 61 | 6 | 1; | |||||||||
| 62 | __END__ | ||||||||||