Fighting with computers

Computers are not always friendly.

Wednesday, September 14, 2011

Playing with RSA

A recent assignment required me to dust off my knowledge of RSA (public-key encryption algorithm). While it is something I do teach every year, I usually do not have to fiddle with the code. So when I was needing a pair of keys (public+private) for some test I needed to look around for some  key-generation code.

Once I've got my pair of keys I was surprised with this implementation of RSA encryption in perl:

#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)
However, the fastest way to get you working is using OpenSSL's genrsa command.

0 Comments:

Post a Comment

<< Home