File Coverage

blib/lib/Crypt/Cipher/RC5.pm
Criterion Covered Total %
statement 17 17 100.0
branch n/a
condition n/a
subroutine 9 9 100.0
pod 6 6 100.0
total 32 32 100.0


line stmt bran cond sub pod time code
1             package Crypt::Cipher::RC5;
2              
3             ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY!
4              
5 3     3   1113 use strict;
  3         3  
  3         78  
6 3     3   24 use warnings;
  3         3  
  3         141  
7             our $VERSION = '0.088_004';
8              
9 3     3   11 use base qw(Crypt::Cipher);
  3         3  
  3         801  
10              
11             sub new {
12 13     13 1 35 my ($class, @args) = @_;
13 13         127 my $obj = Crypt::Cipher->new('RC5', @args);
14 13         80 return bless $obj, $class;
15             }
16              
17 3     3 1 126869 sub blocksize { Crypt::Cipher::blocksize('RC5') }
18 3     3 1 11 sub keysize { Crypt::Cipher::keysize('RC5') }
19 3     3 1 13 sub max_keysize { Crypt::Cipher::max_keysize('RC5') }
20 4     4 1 314 sub min_keysize { Crypt::Cipher::min_keysize('RC5') }
21 3     3 1 23 sub default_rounds { Crypt::Cipher::default_rounds('RC5') }
22              
23             1;
24              
25             =pod
26              
27             =head1 NAME
28              
29             Crypt::Cipher::RC5 - Symmetric cipher RC5, key size: 64-1024 bits
30              
31             =head1 SYNOPSIS
32              
33             ### example 1
34             use Crypt::Mode::CBC;
35              
36             my $key = '...'; # length has to be valid key size for this cipher
37             my $iv = '...'; # 16 bytes
38             my $cbc = Crypt::Mode::CBC->new('RC5');
39             my $ciphertext = $cbc->encrypt("secret data", $key, $iv);
40              
41             ### example 2 (slower)
42             use Crypt::CBC;
43             use Crypt::Cipher::RC5;
44              
45             my $key = '...'; # length has to be valid key size for this cipher
46             my $iv = '...'; # 16 bytes
47             my $cbc = Crypt::CBC->new( -cipher=>'Cipher::RC5', -key=>$key, -iv=>$iv );
48             my $ciphertext = $cbc->encrypt("secret data");
49              
50             =head1 DESCRIPTION
51              
52             This module implements the RC5 cipher. Provided interface is compliant with L module.
53              
54             B This module implements just elementary "one-block-(en|de)cryption" operation - if you want to
55             encrypt/decrypt generic data you have to use some of the cipher block modes - check for example
56             L, L or L (which will be slower).
57              
58             =head1 METHODS
59              
60             Unless noted otherwise, assume C<$c> is an existing cipher object created via
61             C, for example:
62              
63             my $c = Crypt::Cipher::RC5->new($key);
64              
65             =head2 new
66              
67             my $c = Crypt::Cipher::RC5->new($key);
68             #or
69             my $c = Crypt::Cipher::RC5->new($key, $rounds);
70              
71             # $key .... [binary string] key of an accepted length (see keysize, min_keysize, max_keysize)
72             # $rounds . [integer] optional, number of rounds (if supported by the cipher; croaks on invalid value)
73              
74             =head2 encrypt
75              
76             Encrypts exactly one block of plaintext. The length of C<$plaintext> must
77             equal L; croaks otherwise. An empty string is accepted and
78             returned unchanged.
79              
80              
81              
82             my $ciphertext = $c->encrypt($plaintext);
83              
84             Returns the encrypted block as a binary string (raw bytes).
85              
86             =head2 decrypt
87              
88             Decrypts exactly one block of ciphertext. The length of C<$ciphertext> must
89             equal L; croaks otherwise. An empty string is accepted and
90             returned unchanged.
91              
92             my $plaintext = $c->decrypt($ciphertext);
93              
94             Returns the decrypted block as a binary string (raw bytes).
95              
96             =head2 keysize
97              
98             Just an alias for C.
99              
100             $c->keysize;
101             #or
102             Crypt::Cipher::RC5->keysize;
103             #or
104             Crypt::Cipher::RC5::keysize;
105              
106             =head2 blocksize
107              
108             Returns the cipher block size (in bytes).
109              
110             $c->blocksize;
111             #or
112             Crypt::Cipher::RC5->blocksize;
113             #or
114             Crypt::Cipher::RC5::blocksize;
115              
116             =head2 max_keysize
117              
118             Returns the maximum key size (in bytes).
119              
120             $c->max_keysize;
121             #or
122             Crypt::Cipher::RC5->max_keysize;
123             #or
124             Crypt::Cipher::RC5::max_keysize;
125              
126             =head2 min_keysize
127              
128             Returns the minimum key size (in bytes).
129              
130             $c->min_keysize;
131             #or
132             Crypt::Cipher::RC5->min_keysize;
133             #or
134             Crypt::Cipher::RC5::min_keysize;
135              
136             =head2 default_rounds
137              
138             Returns the cipher's default round count.
139              
140             $c->default_rounds;
141             #or
142             Crypt::Cipher::RC5->default_rounds;
143             #or
144             Crypt::Cipher::RC5::default_rounds;
145              
146             =head1 SEE ALSO
147              
148             =over
149              
150             =item * L, L
151              
152             =item * L
153              
154             =back
155              
156             =cut