blib/lib/RIPEMD160.pm

filter: Statementstmt 97.5% 39 / 40 Branchbran 90.0% 9 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 4 totaltotal 90.1% 55 / 61 CC 6 SCAR 8.5
CC
6
Cov
96%
addfile
4.0
hash
2.1
hexhash
2.0
CRAP 2.3
« blib/lib/RIPEMD160/MAC.pm ↑ Summary wrap_160.c »
1 package RIPEMD160;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use vars qw($VERSION @ISA @EXPORT);
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 require Exporter;
7 1 require DynaLoader;
8 1 require AutoLoader;
9 1 @ISA = qw(Exporter AutoLoader DynaLoader);
10  
11 # Items to export into callers namespace by default
12 1 @EXPORT = qw();
13 1 $VERSION = '0.02';
14  
15 1 bootstrap RIPEMD160 $VERSION;
16  
17 sub addfile
18 6 ▶{
Subroutine addfile: called CC=4 SCAR=13.9
Pod undocumented
19 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
20 6 my ($self, $handle) = @_;
21 6 my ($package, $file, $line) = caller;
22 6 my ($data);
23  
24 6 ▶ if (!ref($handle)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $handle) 5 1 6
25 5 ▶ $handle = $package . "::" . $handle unless ($handle =~ /(\:\:|\')/);
Branch: 1 branch
BranchTrueFalseTotal
unless $handle =~ /(\:\:|\')/ 1 4 5
26 }
27 6 ▶ while (read($handle, $data, 8192)) {
Branch: 1 branch
BranchTrueFalseTotal
if (read $handle, $data, 8192) 6 6 12
28 6 $self->add($data);
29 }
30 }
31  
32 sub hexdigest
33 19 ▶{
Subroutine hexdigest: called CC=1 SCAR=0.0
Pod undocumented
34 19 my ($self) = shift;
35 19 my ($tmp);
36  
37 19 $tmp = unpack("H*", ($self->digest()));
38 19 return(substr($tmp, 0,8) . " " . substr($tmp, 8,8) . " " .
39 substr($tmp,16,8) . " " . substr($tmp,24,8) . " " .
40 substr($tmp,32,8));
41 }
42  
43 sub hash
44 3 ▶{
Subroutine hash: called CC=2 SCAR=7.2
Pod undocumented
45 3 my($self, $data) = @_;
46  
47 3 ▶ if (ref($self)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self) { } 0 3 3
48 0 $self->reset();
49 } else {
50 3 $self = new RIPEMD160;
51 }
52 3 $self->add($data);
53 3 $self->digest();
54 }
55  
56 sub hexhash
57 10 ▶{
Subroutine hexhash: called CC=2 SCAR=6.9
Pod undocumented
58 10 my($self, $data) = @_;
59  
60 10 ▶ if (ref($self)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self) { } 1 9 10
61 1 $self->reset();
62 } else {
63 9 $self = new RIPEMD160;
64 }
65 10 $self->add($data);
66 10 $self->hexdigest();
67 }
68  
69 1 1;
70 __END__
« blib/lib/RIPEMD160/MAC.pm ↑ Summary wrap_160.c »