File Coverage

blib/lib/Net/SSH/Perl/Cipher/IDEA.pm
Criterion Covered Total %
statement 30 30 100.0
branch 1 2 50.0
condition n/a
subroutine 10 10 100.0
pod 3 4 75.0
total 44 46 95.6


line stmt bran cond sub pod time code
1             package Net::SSH::Perl::Cipher::IDEA;
2              
3 1     1   7 use strict;
  1         3  
  1         39  
4 1     1   20 use warnings;
  1         2  
  1         56  
5              
6 1     1   6 use Net::SSH::Perl::Cipher;
  1         2  
  1         30  
7 1     1   6 use base qw( Net::SSH::Perl::Cipher );
  1         2  
  1         185  
8              
9 1     1   593 use Net::SSH::Perl::Cipher::CFB;
  1         3  
  1         41  
10 1     1   676 use Crypt::IDEA;
  1         1314  
  1         284  
11              
12             sub new {
13 6     6 1 13 my $class = shift;
14 6         19 my $ciph = bless { }, $class;
15 6 50       32 $ciph->init(@_) if @_;
16 6         65 $ciph;
17             }
18              
19             sub init {
20 6     6 0 11 my $ciph = shift;
21 6         14 my($key, $iv) = @_;
22 6         82 my $idea = IDEA->new(substr $key, 0, 16);
23 6         148 $ciph->{cfb} = Net::SSH::Perl::Cipher::CFB->new($idea, $iv);
24             }
25              
26             sub encrypt {
27 3     3 1 2204 my($ciph, $text) = @_;
28 3         15 $ciph->{cfb}->encrypt($text);
29             }
30              
31             sub decrypt {
32 3     3 1 15 my($ciph, $text) = @_;
33 3         10 $ciph->{cfb}->decrypt($text);
34             }
35              
36             1;
37             __END__