rsa-dolphin
rsa algorithm in perl, dc and gp
(optimized for export)
by vipul ved prakash
january, 1999.


#!/usr/bin/perl -s @x=qw/e n d/;if( $kg){$e=13;$_="setrand(@{[int((rand)*90)]}) ;K=vector(2,g,nextprime(random(10^$s)));e=$e;n=K[1]* K[2];d=e^-1%((K[1]-1)*(K[2]-1));";s/\s//sg;for( `echo "$_ e\nn\nd\n"|gp -q`){print$x[$j++] ,"=",`echo "10i16o$_ p"|dc`}exit}$t= unpack'H*',join'',<>;$l=length$n;$y =$e?$l-2:$l;$i="16dio";while (){$M= ($e&&1+int(rand 8)).(substr $t,$p ,$y or last);$i.="\U$M $k $n\E| pc";$p+=$y}for(reverse `echo "$i"|dc`){chop ;$d&&s/^(.)//||($_= sprintf"%0${l}s" ,$_); $f .=$_}# print pack 'H*' ,$f

syntax
    generate a 1024-bit key: fin -kg -s=155
    generate a 2048-bit key: fin -kg -s=309 (Takes a while)
    encrypt/decrypt/sign/verify: fin -k=key -n=rsa_modulus [-e/-d] files

requirements
related links