1#! /bin/false
2
3# vim: tabstop=4
4# $Id: Key16.pm,v 1.1.1.1 2003/11/21 21:06:56 guido Exp $
5
6# Twofish in pure Perl.
7# Copyright (C) 2003 Guido Flohr <guido@imperia.net>, all rights reserved.
8
9# This program is free software; you can redistribute it and/or modify it
10# under the same terms and conditions as Perl itsels (see the Artistic
11# license included).
12
13package Crypt::Twofish_PP::Key16;
14
15use strict;
16
17use Crypt::Twofish_PP;
18use base qw (Crypt::Twofish_PP);
19
20use vars qw ($KEYSIZE);
21
22# See method keysize() below for an explanation.
23$KEYSIZE = 16;
24
25sub keysize
26{
27	my $self = shift;
28
29	if (ref $self) {
30		return $self->{__keylength} * 8;
31	} else {
32		# When called as a class method, return a constant value.
33		return $KEYSIZE;
34	}
35}
36
371;
38
39__END__
40
41=head1 NAME
42
43Crypt::Twofish_PP::Key16 - Twofish with 16 byte (128 bits) keysize
44
45=head1 SYNOPSIS
46
47  use Crypt::CBC;
48  my $cipher = Crypt::CBC->new (key => 'my secret key',
49                                cipher => 'Twofish_PP::Key16');
50
51=head1 DESCRIPTION
52
53This module is only a helper module and you should never use it
54directly.  Use Crypt::Twofish_PP(3) instead and see there for more
55documentation.
56
57The standard module for Cipher Block Chaining (CBC) in Perl,
58Crypt::CBC(3) cannot grok with variable key sizes.  However, the
59Twofish algorithm is defined for key sizes of 16, 24, and 32 bytes,
60but there is no way to communicate that to Crypt::CBC.
61
62If you want to use Crypt::Twofish_PP(3) in CBC mode with a keysize of
6316, simply specify B<Crypt::Twofish_PP::Key16> as the algorithm.  It
64is eqeuivalent to Crypt::Twofish_PP(3) but it will report a default
65keysize of 16 bytes back to Crypt::CBC(3).
66
67Note that this is not necessarily the real keysize.  The method
68keysize() of Crypt::Twofish_PP(3) only exists to satisfy Crypt::CBC(3).
69The module will derive the real keysize from the length of the key
70you supply.
71
72=head1 AUTHOR
73
74Copyright (C) 2003, Guido Flohr E<lt>guido@imperia.netE<gt>, all
75rights reserved.  See the source code for details.
76
77This software is contributed to the Perl community by Imperia
78(L<http://www.imperia.net/>).
79
80=head1 SEE ALSO
81
82Crypt::CBC(3), Crypt::Twofish_PP(3), Crypt::Twofish::Key24(3),
83Crypt::Twofish_PP::Key32(3), perl(1)
84
85=cut
86Local Variables:
87mode: perl
88perl-indent-level: 4
89perl-continued-statement-offset: 4
90perl-continued-brace-offset: 0
91perl-brace-offset: -4
92perl-brace-imaginary-offset: 0
93perl-label-offset: -4
94cperl-indent-level: 4
95cperl-continued-statement-offset: 2
96tab-width: 4
97End:
98=cut
99