diff options
Diffstat (limited to 'perl/mul.pl')
-rw-r--r-- | perl/mul.pl | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/perl/mul.pl b/perl/mul.pl deleted file mode 100644 index d4dea48192..0000000000 --- a/perl/mul.pl +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/local/bin/perl - -use ExtUtils::testlib; - -use SSLeay; - - -sub mul - { - my($ab,$cd,$num)=@_; - - if ($num <= 4096) - { - return($ab*$cd); - } - else - { - my($a,$b,$c,$d,$n,$ac,$bd,$m,$t1,$t2); - - $n=$num/2; - - $a=$ab->mask_bits($n); - $b=$ab->rshift($n); - $c=$cd->mask_bits($n); - $d=$cd->rshift($n); - - $t1=($b-$a); - $t2=($c-$d); - $m= &mul($t1,$t2,$n); - $ac=&mul($a,$c,$n); - $bd=&mul($b,$d,$n); - $m=$m+$ac+$bd; - $m=$m->lshift($n); - $bd=$bd->lshift($num); - - $r=$ac+$m+$bd; - return($r); - } - } - -$num=4096*32; -$a=SSLeay::BN::rand($num); -$b=SSLeay::BN::rand($num); - -#for (1 .. 10) - { - $r=&mul($a,$b,$num); - } - -#for (1 .. 10) - { - $rr=$a*$b; - } - -$res=$rr-$r; -print $res->bn2hex()."\n"; |