f69b036666aa456ab35d44196ae6ac6d48e45d16
[openssl.git] / crypto / bn / m.pl
1 #!/usr/local/bin/perl
2
3
4 for ($i=0; $i<256; $i++)
5         {
6         for ($j=0; $j<256; $j++)
7                 {
8                 $a0=$i&0x0f;
9                 $a1=($i>>4)&0x0f;
10                 $b0=$j&0x0f;
11                 $b1=($j>>4)&0x0f;
12
13                 $a0b0=$a0*$b0;
14                 $a1b1=$a1*$b1;
15
16                 $a01=$a0-$a1;
17                 $b10=$b1-$b0;
18                 $a01b10=$a01*$b10;
19
20                 if ($a01b10 < 0)
21                         {
22                         $neg=1;
23                         $a01b10= -$a01b10;
24                         }
25                 $t=($a0b0>>4)+($a0b0&0x0f)+($a1b1&0x0f);
26                 if ($neg)
27                         { $t-=($a01b10&0x0f); }
28                 else    { $t+=($a01b10&0x0f); }
29                 printf("%02X %s%02X %02X\n",$a1b1,($neg)?"-":" ",$a01b10,$a0b0)
30                         if ($t < 0)
31                 }
32         }