math/mpreduce.h: Missing include files.
[u/mdw/catacomb] / symm / aes-trans
1 #! /bin/sh
2
3 prog=`echo $0 | sed 's:.*/::'`
4 alg=${1?}; shift
5 lc=`echo $alg | tr A-Z a-z`
6
7 cat <<EOF
8 # Test vectors for $alg
9 #
10 # Generated on `date +%Y-%m-%d` by $prog
11
12 $lc {
13 EOF
14
15 awk "$@" '
16 function mangle(x, y) {
17 if (!rev)
18 return x;
19 y = "";
20 while (length(x) > 1) {
21 y = y substr(x, length(x) - 1);
22 x = substr(x, 1, length(x) - 2);
23 }
24 return y;
25 }
26
27 BEGIN { FS = "="; }
28 /^KEY=/ { key = mangle($2); }
29 /^PT=/ { pt = mangle($2); }
30 /^CT=/ {
31 ct = mangle($2);
32 printf(" %s\n %s\n %s;\n", key, pt, ct);
33 }
34 '
35 echo }
36