| 1 | #! /usr/bin/perl |
| 2 | |
| 3 | $s = undef; |
| 4 | $what = undef; |
| 5 | $sep = "\n"; |
| 6 | while (<>) { |
| 7 | if (/^Primitive Name: (.*)$/) { |
| 8 | print $sep, lc $1, " {\n"; |
| 9 | $sep = "}\n\n"; |
| 10 | } |
| 11 | next unless /^ /; |
| 12 | @f = split; |
| 13 | if (@f == 3 && $f[1] == "=") { |
| 14 | if (defined $s) { |
| 15 | die "not a block boundary" if $pos % 64; |
| 16 | $hp = sprintf "%016x", $pos/64; |
| 17 | print " $k\n $n $hp 0 \"\"\n $s;\n"; |
| 18 | undef $s; |
| 19 | undef $what; |
| 20 | } |
| 21 | if ($f[0] eq "key") { $k = lc $f[2]; $what = \$k; } |
| 22 | elsif ($f[0] eq "IV") { $n = lc $f[2]; } |
| 23 | elsif ($f[0] =~ /^stream\[(\d+)\.\.(\d+)]$/) { |
| 24 | $pos = $1; |
| 25 | $s = lc $f[2]; |
| 26 | $what = \$s; |
| 27 | } |
| 28 | } elsif (@f == 1) { |
| 29 | if (defined $what) { $$what .= lc $f[0]; } |
| 30 | } else { |
| 31 | die "incomprehensible line"; |
| 32 | } |
| 33 | } |
| 34 | print $sep; |