blib/lib/Net/SSH/Perl/Util/SSH1MP.pm

filter: Statementstmt 39.3% 13 / 33 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 66.6% 4 / 6 Podpod n/a totaltotal 35.4% 17 / 48 SCAR 25.6
CC
5
Cov
32%
_mp_linearize
30.0
_compute_session_id
2.0
BEGIN
1.0
CRAP 13.0
« blib/lib/Net/SSH/Perl/Util/Term.pm ↑ Summary blib/lib/Net/SSH/Perl/Handle.pm »
1 package Net::SSH::Perl::Util::SSH1MP;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use Digest::MD5 qw( md5 );
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Math::GMP;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 sub _compute_session_id {
9 0 ▶ my($check_bytes, $host, $public) = @_;
Subroutine _compute_session_id: not called CC=1 SCAR=6.9
10 0 my $id;
11 0 $id .= _mp_linearize($host->{rsa}{n});
12 0 $id .= _mp_linearize($public->{rsa}{n});
13 0 $id .= $check_bytes;
14 0 md5($id);
15 }
16  
17 sub _mp_linearize {
18 0 ▶ my($p, $l) = @_;
Subroutine _mp_linearize: not called CC=5 SCAR=34.0
19 0 ▶ $l ||= 0;
Condition0%0/2
$l ||= 0
l!l
00
MC/DC0%0/1
$l ||= 0
$l
Truth table0%0/2
A
A= $l
Aresult
11
00
20 0 my $base = Math::GMP->new(256);
21 0 my $res = '';
22 {
23 0 my $r = $p % $base;
24 0 my $d = Math::GMP->new($p-$r) / $base;
25 0 $res = chr($r) . $res;
26 0 ▶ if ($d >= $base) {
Branch: 2 branches
BranchTrueFalseTotal
if ($d >= $base) { } 0 0 0
elsif ($d != 0) { } 0 0 0
27 0 $p = $d;
28 0 redo;
29 }
30 elsif ($d != 0) {
31 0 $res = chr($d) . $res;
32 }
33 }
34 0 ▶ $res = "\0" x ($l-length($res)) . $res
Branch: 1 branch
BranchTrueFalseTotal
if length $res < $l 0 0 0
35 if length($res) < $l;
36 0 $res;
37 }
38  
39 1 1;
« blib/lib/Net/SSH/Perl/Util/Term.pm ↑ Summary blib/lib/Net/SSH/Perl/Handle.pm »