Slight reorganization. Add elliptic curves from X9.62.
[u/mdw/catacomb] / binctab
1 #! /usr/bin/perl
2
3 sub tobin { my ($x) = @_; my $s = ($x & 8 ? "1" : "0") . ($x & 4 ? "1" : "0")
4 . ($x & 2 ? "1" : "0") . ($x & 1 ? "1" : "0"); return $s; } for ($i = 0; $i
5 < 16; $i++) { $p_base = $p_an = $p_bn = $p_abn = "POS"; $base = $i; $an =
6 (($i & 3) << 2) | (($i & 12) >> 2); $bn = (($i & 5) << 1) | (($i & 10) >> 1);
7 $abn = (($an & 5) << 1) | (($an & 10) >> 1); if ($base & 8) { $base ^= 15;
8 $p_base = "NEG"; } if ($an & 8) { $an ^= 15; $p_an = "NEG"; } if ($bn & 8) {
9 $bn ^= 15; $p_bn = "NEG"; } if ($abn & 8) { $abn ^= 15; $p_abn = "NEG"; }
10 print "MP_BIT2CBINOP(" . join(", ", tobin($base), tobin($an), tobin($bn),
11 tobin($abn), $p_base, $p_an, $p_bn, $p_abn) . ")\n"; }