| 1 | package Digest::Haval256; | ||||||||||
| 2 | |||||||||||
| 3 | 13 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 13 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 13 | ▶ | use MIME::Base64; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 13 | require Exporter; | |||||||||
| 7 | |||||||||||
| 8 | 13 | our @EXPORT_OK = qw(new hashsize rounds reset add addfile digest hexdigest base64digest); | |||||||||
| 9 | 13 | our $VERSION = '1.0.5'; | |||||||||
| 10 | 13 | our @ISA = qw(Exporter); | |||||||||
| 11 | |||||||||||
| 12 | 13 | require XSLoader; | |||||||||
| 13 | 13 | XSLoader::load('Digest::Haval256', $VERSION); | |||||||||
| 14 | |||||||||||
| 15 | # Preloaded methods go here. | ||||||||||
| 16 | |||||||||||
| 17 | sub addfile | ||||||||||
| 18 | 6 | ▶ | { | ||||||||
|
Subroutine
addfile: called CC=4 SCAR=14.0
Pod
documented
| |||||||||||
| 19 | 6 | my ($self, $handle) = @_; | |||||||||
| 20 | 6 | my ($package, $file, $line) = caller; | |||||||||
| 21 | |||||||||||
| 22 | 6 | ▶ | if (!ref($handle)) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | 6 | ▶ | $handle = "$package::$handle" unless ($handle =~ /(\:\:|\')/); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | } | ||||||||||
| 25 | |||||||||||
| 26 | 6 | ▶ | while (read($handle, my $data, 1048576)) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | 5 | $self->add($data); | |||||||||
| 28 | } | ||||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | sub hexdigest | ||||||||||
| 32 | 12 | ▶ | { | ||||||||
|
Subroutine
hexdigest: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 33 | 12 | my $self = shift; | |||||||||
| 34 | 12 | return unpack("H*", $self->digest()); | |||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | sub base64digest | ||||||||||
| 38 | 0 | ▶ | { | ||||||||
|
Subroutine
base64digest: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 39 | 0 | my $self = shift; | |||||||||
| 40 | 0 | return encode_base64($self->digest(), ""); | |||||||||
| 41 | } | ||||||||||
| 42 | |||||||||||
| 43 | 13 | 1; | |||||||||
| 44 | |||||||||||
| 45 | __END__ | ||||||||||