PGP in < 100 lines of perl (was Re: Fuck the usenet cabal)

Adam Back aba at
Thu Aug 14 05:08:59 PDT 1997

Dimitri Vulis <dlv at> writes:
> > > Is it possible to stuff a blatant ITAR violation into about 100
> > > lines 
> >
> > Already been done.  RSA in 4 lines of Perl, etc...  
> I mean a useable package.

I once started trying to implement full PGP functionality in as few
lines of perl/dc as possible.

I got pgp signature verification working.
and PGP compatible IDEA PRZ style CFB mode in 9 lines.  
and PGP key lookup in 7 lines.
and MD5 in 8 lines.

(Several of those were other peoples contributions)

If you used /dev/random for random numbers plus a bit more glue, it
would've worked.  Everything put compression and key generation.

There was a perl competition for the most interesting program in under
2000 characters of perl.  I ran out of enthousiasm, patience before

With a whole 100 lines to play with you could probably do key gen and
compression too.  (I wondered if you could shell gzip or zip and some
hacking to get PGP zip functionality, as it is just ripped off zip

Makes you wonder what PRZ did wrong with pgp 2.x, what did he use to
pad it out to 34,881 lines?

PGP 5.0 is fearsomely large, and I'm sure you could do the rest too in
a few more 10s of lines (already got an SHA1, DSS is more twiddling in
dc, already got DES in 21 lines, no CAST but that wouldn't be too

If anyone is interested naturally I can share the current code.  The
perl 2000 char competition probably is once a year or something.

Any takers?

Have *you* exported RSA today? -->

print pack"C*",split/\D+/,`echo "16iII*o\U@{$/=$z;[(pop,pop,unpack"H*",<>

More information about the cypherpunks-legacy mailing list