3 # $Id: algs.PL,v 1.1 2004/04/02 18:04:01 mdw Exp $
5 # Create tables of algorithms
7 # (c) 2001 Straylight/Edgeware
10 #----- Licensing notice -----------------------------------------------------
12 # This file is part of the Perl interface to Catacomb.
14 # Catacomb/Perl is free software; you can redistribute it and/or modify
15 # it under the terms of the GNU General Public License as published by
16 # the Free Software Foundation; either version 2 of the License, or
17 # (at your option) any later version.
19 # Catacomb/Perl is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU General Public License for more details.
24 # You should have received a copy of the GNU General Public License
25 # along with Catacomb/Perl; if not, write to the Free Software Foundation,
26 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 #----- Revision history -----------------------------------------------------
31 # Revision 1.1 2004/04/02 18:04:01 mdw
35 @cipher = qw(des desx des3
40 square rijndael rijndael192 rijndael256
45 @stream = qw(rc4 seal);
46 @hash = qw(md5 md4 md2 tiger
47 sha sha256 sha384 sha512
48 rmd128 rmd160 rmd256 rmd320);
52 if (!ref($x)) { return $x; }
53 elsif (ref($x) eq ARRAY) { return @$x }
54 else { die "bad ref"; }
63 foreach my $j (@$x) { foreach my $k (@y) { push(@x, $j.$k); } }
72 open OUT, "> $ARGV[0]" or die "couldn't write `$ARGV[0].c': $!";
80 #include "catacomb-perl.h"
82 #include <catacomb/crc32.h>
85 print OUT cross("#include <catacomb/", \@cipher, "-",
86 [qw(ecb cbc cfb counter ofb)], ".h>\n"), "\n";
87 print OUT cross("#include <catacomb/", \@stream, ".h>\n"), "\n";
88 print OUT cross("#include <catacomb/", \@hash, ".h>\n"), "\n";
89 print OUT cross("#include <catacomb/", \@hash, "-",
90 [qw(mgf hmac)], ".h>\n"), "\n";
94 const gccipher *ciphertab[] = {
96 print OUT cross(" &", \@cipher, "_", [qw(ecb cbc cfb counter ofb)], ",\n");
97 print OUT cross(" &", \@hash, "_", [qw(mgf)], ",\n");
98 print OUT cross(" &", \@stream, ",\n");
103 const gchash *hashtab[] = {
105 print OUT cross(" &", \@hash, ",\n");
111 const gcmac *mactab[] = {
113 print OUT cross(" &", \@hash, "_", [qw(hmac nmac sslmac)], ",\n");
118 const struct randtab mgftab[] = {
120 foreach my $i (@hash) { print OUT " { \"$i\", ${i}_mgfrand },\n"; }
125 const struct randtab ctrtab[] = {
127 foreach my $i (@cipher) { print OUT " { \"$i\", ${i}_counterrand },\n"; }
132 const struct randtab ofbtab[] = {
134 foreach my $i (@cipher) { print OUT " { \"$i\", ${i}_ofbrand },\n"; }
140 #----- That's all, folks ----------------------------------------------------