Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perl-5.8.0 / lib / site_perl / 5.8.0 / sun4-solaris / Crypt / Rijndael.pm
CommitLineData
86530b38
AT
1=head1 NAME
2
3Crypt::Rijndael - Crypt::CBC compliant Rijndael encryption module
4
5=head1 SYNOPSIS
6
7 use Crypt::Rijndael;
8
9 # keysize() is 32, but 24 and 16 are also possible
10 # blocksize() is 16
11
12 $cipher = new Crypt::Rijndael "a" x 32, Crypt::Rijndael::MODE_CBC;
13
14 $cipher->set_iv($iv);
15 $crypted = $cipher->encrypt($plaintext);
16 # - OR -
17 $plaintext = $cipher->decrypt($crypted);
18
19=head1 DESCRIPTION
20
21This module implements the Rijndael cipher, which has just been selected
22as the Advanced Encryption Standard.
23
24=over 4
25
26=cut
27
28package Crypt::Rijndael;
29
30require DynaLoader;
31
32$VERSION = 0.04;
33@ISA = qw/DynaLoader/;
34
35bootstrap Crypt::Rijndael $VERSION;
36
37=item keysize
38
39Returns the keysize, which is 32 (bytes). The Rijndael cipher
40actually supports keylengths of 16, 24 or 32 bytes, but there is no
41way to communicate this to C<Crypt::CBC>.
42
43=item blocksize
44
45The blocksize for Rijndael is 16 bytes (128 bits), although the
46algorithm actually supports any blocksize that is any multiple of
47our bytes. 128 bits, is however, the AES-specified block size,
48so this is all we support.
49
50=item $cipher = new $key [, $mode]
51
52Create a new C<Crypt::Rijndael> cipher object with the given key
53(which must be 128, 192 or 256 bits long). The additional C<$mode>
54argument is the encryption mode, either C<MODE_ECB> (electronic
55codebook mode, the default), C<MODE_CBC> (cipher block chaining, the
56same that C<Crypt::CBC> does), C<MODE_CFB> (128-bit cipher feedback),
57C<MODE_OFB> (128-bit output feedback), or C<MODE_CTR> (counter mode).
58
59ECB mode is very insecure (read a book on cryptography if you dont
60know why!), so you should probably use CBC mode.
61
62=item $cipher->set_iv($iv)
63
64This allows you to change the initial value vector used by the
65chaining modes. It is not relevant for ECB mode.
66
67=item $cipher->encrypt($data)
68
69Encrypt data. The size of C<$data> must be a multiple of C<blocksize>
70(16 bytes), otherwise this function will croak. Apart from that, it
71can be of (almost) any length.
72
73=item $cipher->decrypt($data)
74
75Decrypts C<$data>.
76
77=back
78
79=head1 SEE ALSO
80
81 L<Crypt::CBC>, http://www.csrc.nist.gov/encryption/aes/
82
83=head1 BUGS
84
85Should EXPORT or EXPORT_OK the MODE constants.
86
87=head1 AUTHOR
88
89 Rafael R. Sevilla <sevillar@team.ph.inter.net>
90
91 The Rijndael Algorithm was developed by Vincent Rijmen and Joan Daemen,
92 and has been selected as the US Government's Advanced Encryption Standard.
93
94=cut
95
961;
97