# Build perl code that calculates the key schedule # The key schedule is a maze of twisty little bit operations, # all different. You'd go nuts doing it by hand. use strict; use warnings; # This key schedule specification is right out of RFC2144 $_ = < '$s', 'x4x5x6x7' => '$t', 'x8x9xAxB' => '$u', 'xCxDxExF' => '$v', 'z0z1z2z3' => '$w', 'z4z5z6z7' => '$x', 'z8z9zAzB' => '$y', 'zCzDzEzF' => '$z', 'x0' => '$s>>24&255', 'x1' => '$s>>16&255', 'x2' => '$s>>8&255', 'x3' => '$s&255', 'x4' => '$t>>24&255', 'x5' => '$t>>16&255', 'x6' => '$t>>8&255', 'x7' => '$t&255', 'x8' => '$u>>24&255', 'x9' => '$u>>16&255', 'xA' => '$u>>8&255', 'xB' => '$u&255', 'xC' => '$v>>24&255', 'xD' => '$v>>16&255', 'xE' => '$v>>8&255', 'xF' => '$v&255', 'z0' => '$w>>24&255', 'z1' => '$w>>16&255', 'z2' => '$w>>8&255', 'z3' => '$w&255', 'z4' => '$x>>24&255', 'z5' => '$x>>16&255', 'z6' => '$x>>8&255', 'z7' => '$x&255', 'z8' => '$y>>24&255', 'z9' => '$y>>16&255', 'zA' => '$y>>8&255', 'zB' => '$y&255', 'zC' => '$z>>24&255', 'zD' => '$z>>16&255', 'zE' => '$z>>8&255', 'zF' => '$z&255', ); s/ //g; s/\n/;\n/g; s/S/\$s/g; s/K\d+=/push\@k,/g; s/((?:[xz][0-9A-F])+)/$table{$1}||$1/eg; print;