Filename | /usr/local/lib/perl5/site_perl/mach/5.24/Razor2/Client/Engine.pm |
Statements | Executed 15 statements in 1.73ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 2.25ms | 2.47ms | BEGIN@6 | Razor2::Client::Engine::
1 | 1 | 1 | 1.67ms | 9.98ms | BEGIN@8 | Razor2::Client::Engine::
1 | 1 | 1 | 711µs | 4.95ms | BEGIN@7 | Razor2::Client::Engine::
1 | 1 | 1 | 43µs | 53µs | BEGIN@3 | Razor2::Client::Engine::
1 | 1 | 1 | 28µs | 236µs | BEGIN@9 | Razor2::Client::Engine::
1 | 1 | 1 | 24µs | 113µs | BEGIN@4 | Razor2::Client::Engine::
1 | 1 | 1 | 24µs | 137µs | BEGIN@5 | Razor2::Client::Engine::
0 | 0 | 0 | 0s | 0s | compute_engine | Razor2::Client::Engine::
0 | 0 | 0 | 0s | 0s | new | Razor2::Client::Engine::
0 | 0 | 0 | 0s | 0s | supported_engines | Razor2::Client::Engine::
0 | 0 | 0 | 0s | 0s | vr4_signature | Razor2::Client::Engine::
0 | 0 | 0 | 0s | 0s | vr8_signature | Razor2::Client::Engine::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Razor2::Client::Engine; | ||||
2 | |||||
3 | 2 | 63µs | 2 | 63µs | # spent 53µs (43+10) within Razor2::Client::Engine::BEGIN@3 which was called:
# once (43µs+10µs) by base::import at line 3 # spent 53µs making 1 call to Razor2::Client::Engine::BEGIN@3
# spent 10µs making 1 call to strict::import |
4 | 2 | 60µs | 2 | 203µs | # spent 113µs (24+89) within Razor2::Client::Engine::BEGIN@4 which was called:
# once (24µs+89µs) by base::import at line 4 # spent 113µs making 1 call to Razor2::Client::Engine::BEGIN@4
# spent 89µs making 1 call to Exporter::import |
5 | 2 | 57µs | 2 | 249µs | # spent 137µs (24+113) within Razor2::Client::Engine::BEGIN@5 which was called:
# once (24µs+113µs) by base::import at line 5 # spent 137µs making 1 call to Razor2::Client::Engine::BEGIN@5
# spent 113µs making 1 call to Exporter::import |
6 | 2 | 297µs | 1 | 2.47ms | # spent 2.47ms (2.25+215µs) within Razor2::Client::Engine::BEGIN@6 which was called:
# once (2.25ms+215µs) by base::import at line 6 # spent 2.47ms making 1 call to Razor2::Client::Engine::BEGIN@6 |
7 | 2 | 278µs | 1 | 4.95ms | # spent 4.95ms (711µs+4.24) within Razor2::Client::Engine::BEGIN@7 which was called:
# once (711µs+4.24ms) by base::import at line 7 # spent 4.95ms making 1 call to Razor2::Client::Engine::BEGIN@7 |
8 | 2 | 329µs | 1 | 9.98ms | # spent 9.98ms (1.67+8.32) within Razor2::Client::Engine::BEGIN@8 which was called:
# once (1.67ms+8.32ms) by base::import at line 8 # spent 9.98ms making 1 call to Razor2::Client::Engine::BEGIN@8 |
9 | 2 | 638µs | 2 | 444µs | # spent 236µs (28+208) within Razor2::Client::Engine::BEGIN@9 which was called:
# once (28µs+208µs) by base::import at line 9 # spent 236µs making 1 call to Razor2::Client::Engine::BEGIN@9
# spent 208µs making 1 call to Exporter::import |
10 | |||||
11 | # meant to be inherited | ||||
12 | # | ||||
13 | sub new { | ||||
14 | return {}; | ||||
15 | } | ||||
16 | |||||
17 | |||||
18 | sub supported_engines { | ||||
19 | |||||
20 | my @a = qw( 4 8 ); | ||||
21 | |||||
22 | my $hr = {}; | ||||
23 | foreach (@a) { $hr->{$_} = 1; } | ||||
24 | |||||
25 | return wantarray ? @a : $hr; | ||||
26 | } | ||||
27 | |||||
28 | |||||
29 | sub compute_engine { | ||||
30 | my ($self, $engine, @params) = @_; | ||||
31 | |||||
32 | return $self->vr4_signature(@params) if $engine == 4; | ||||
33 | return $self->vr8_signature(@params) if $engine == 8; | ||||
34 | |||||
35 | $self->log (1,"engine $engine not supported"); | ||||
36 | return; | ||||
37 | } | ||||
38 | |||||
39 | # | ||||
40 | # The following *_signature subroutines should be | ||||
41 | # the same as the ones on the server | ||||
42 | # | ||||
43 | |||||
44 | |||||
45 | # | ||||
46 | # VR4 Engine - Ephemereal signatures of decoded body content | ||||
47 | # | ||||
48 | sub vr4_signature { | ||||
49 | my ($self, $text, $ep4) = @_; | ||||
50 | my ($seed, $separator) = split /-/, $ep4, 2; | ||||
51 | |||||
52 | return $self->log(1,"vr4_signature: Bad ep4: $ep4") unless ($seed && $separator); | ||||
53 | |||||
54 | my $ehash = new Razor2::Signature::Ephemeral (seed => $seed, separator => $separator); | ||||
55 | my $digest = $ehash->hexdigest($$text); | ||||
56 | |||||
57 | my $sig = hextobase64($digest); | ||||
58 | $self->log (11,"engine 4 computing on ". length($$text) .", sig=$sig"); | ||||
59 | return $sig; | ||||
60 | } | ||||
61 | |||||
62 | |||||
63 | sub vr8_signature { | ||||
64 | my ($self, $text) = @_; | ||||
65 | my $vr8 = Razor2::Engine::VR8->new(); | ||||
66 | |||||
67 | my $sigs = $vr8->signature($text); | ||||
68 | |||||
69 | return $sigs; | ||||
70 | } | ||||
71 | |||||
72 | 1 | 7µs | 1; |