|laziness, impatience, and hubris|
Encryption using perl core functions onlyby redhotpenguin (Deacon)
|on Nov 25, 2007 at 21:52 UTC||Need Help??|
redhotpenguin has asked for the
wisdom of the Perl Monks concerning the following question:
I am transmitting data over a plain text connection and I need a way of encrypting and decrypting the data using only core perl functions since the receiving end is an embedded platform using a basic installation of perl with no modules. On top of that, crypt isn't implemented in perl :) I've tried using pack('C*', unpack('C*', $string)), but it's returning control characters for some non aZ-zZ0-9 characters on decoding (new7\cUÃÂ\cM\cK\cKÃÂ?3ÃÂ\cM\cKQ\cKÃÂ\cW).
I saw a two line implementation of the rsa algorithm in perl but I'm looking for something more lightweight because the client only has 8 megs of ram and a small processor. I've looked at rot13 implementations in perl but to quote, 'it is not much stronger than a one meter cardboard fence'. Any thoughts? Remember, I can't use any modules.
update - a shared secret approach here would be fine, my main concern is putting some level of security in so that the data is not there for the taking.
update - thanks to perrin for the spot, Crypt::Blowfish_PP is a module with no dependencies and uses perl core functions only, I'm going to try it out on my broadcom embedded platform.
update - embedded Blowfish_PP successfully, it takes 12 seconds to construct the blowfish object but hey it works!