The only fiction in which you can find a lovely Perl code related to encryption (a pretty tough algorithm indeed, designed by Bruce Schneier) : CRYPTONOMICON and also Snow Crash from the same author.
I advise these two books to any PM reader ;-)
Comment on if fiction then let there be Perl in it! ;-)
Not that tough. Solitare has a severe bias in its random number generator (external link). Still, I'd like to see more research into strong crypto that can be used without a computer.
---- I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer
Note: All code is untested, unless otherwise stated