← Index
NYTProf Performance Profile   « line view »
For webmerge/scripts/webmerge.pl
  Run on Mon Oct 7 02:42:42 2013
Reported on Mon Oct 7 03:03:18 2013

Filename/usr/lib64/perl5/vendor_perl/5.16.0/Digest/base.pm
StatementsExecuted 6 statements in 2.18ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11183µs185µsDigest::base::::BEGIN@3Digest::base::BEGIN@3
11171µs213µsDigest::base::::BEGIN@4Digest::base::BEGIN@4
0000s0sDigest::base::::add_bitsDigest::base::add_bits
0000s0sDigest::base::::addfileDigest::base::addfile
0000s0sDigest::base::::b64digestDigest::base::b64digest
0000s0sDigest::base::::hexdigestDigest::base::hexdigest
0000s0sDigest::base::::resetDigest::base::reset
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Digest::base;
2
32219µs2288µs
# spent 185µs (83+102) within Digest::base::BEGIN@3 which was called: # once (83µs+102µs) by OCBNET::Spritesets::Sprite::BEGIN@82 at line 3
use strict;
# spent 185µs making 1 call to Digest::base::BEGIN@3 # spent 102µs making 1 call to strict::import
421.94ms2356µs
# spent 213µs (71+142) within Digest::base::BEGIN@4 which was called: # once (71µs+142µs) by OCBNET::Spritesets::Sprite::BEGIN@82 at line 4
use vars qw($VERSION);
# spent 213µs making 1 call to Digest::base::BEGIN@4 # spent 142µs making 1 call to vars::import
515µs$VERSION = "1.16";
6
7# subclass is supposed to implement at least these
8sub new;
9sub clone;
10sub add;
11sub digest;
12
13sub reset {
14 my $self = shift;
15 $self->new(@_); # ugly
16}
17
18sub addfile {
19 my ($self, $handle) = @_;
20
21 my $n;
22 my $buf = "";
23
24 while (($n = read($handle, $buf, 4*1024))) {
25 $self->add($buf);
26 }
27 unless (defined $n) {
28 require Carp;
29 Carp::croak("Read failed: $!");
30 }
31
32 $self;
33}
34
35sub add_bits {
36 my $self = shift;
37 my $bits;
38 my $nbits;
39 if (@_ == 1) {
40 my $arg = shift;
41 $bits = pack("B*", $arg);
42 $nbits = length($arg);
43 }
44 else {
45 ($bits, $nbits) = @_;
46 }
47 if (($nbits % 8) != 0) {
48 require Carp;
49 Carp::croak("Number of bits must be multiple of 8 for this algorithm");
50 }
51 return $self->add(substr($bits, 0, $nbits/8));
52}
53
54sub hexdigest {
55 my $self = shift;
56 return unpack("H*", $self->digest(@_));
57}
58
59sub b64digest {
60 my $self = shift;
61 require MIME::Base64;
62 my $b64 = MIME::Base64::encode($self->digest(@_), "");
63 $b64 =~ s/=+$//;
64 return $b64;
65}
66
67114µs1;
68
69__END__