For one of my cryptography assignments, I had to implement RSA encryption. I figured I’d use my current language of choice, Erlang, to try and tackle this challenge. After implementing some nicely optimized tail-recursive algorithms, I found that Erlang was very slow at doing large numerical operations. Feeling as if I’d hit a brick wall, I started looking into using other languages as libraries for the math operations. At first, I was looking at connecting Erlang to GMP though the ei library for data conversion. Alas, I was not really feeling like programming in C at the moment, and so I got really excited when I found JInterface, a java library to connect to Erlang nodes using the native networking protocol. After playing around with the code for a little, I ported most of the important BigInteger methods to an Erlang wrapper module javabignum, which would deal with starting the Java server, and handle all the communication to and from the server. This solution worked wonderfully, and I implemented a simple RSA cipher in less than 30 lines of Erlang code! To checkout the code, visit the SVN repository using the username ‘anonymous’ and the password ‘anonymous’.
Peace and chow,
Ranok
