Bitcoin Institute

Adam Back, 'export-a-crypto-system sig': RSA in three lines of Perl

Figures: Adam Back
Adam Back January 28, 1999 13:11 UTC

export-a-crypto-system sig

This is a perl program which implements RSA encryption and decryption, and is small enough to use as a signature file. Peter Junger, a law professor in the US, obtained from the US Commerce department a written statement (http://samsara.law.cwru.edu/comp_law/jvd/pdj-bxa-gjs070397.htm) ruling that this program must not be exported from the US.

Please use this sig file (http://www.dcs.ex.ac.uk/~aba/rsa/perl-rsa-sig.html):

     -export-a-crypto-system-sig -RSA-3-lines-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*',/((..)*)$/)

or more recent 2 line version:

print pack"C*",split/\D+/,`echo "16iII*o\U@{$/=$z;[(pop,pop,unpack"H*",<>
)]}\EsMsKsN0[lN*1lK[d2%Sa2/d0<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<J]dsJxp"|dc`

List of versions, and explanations of how it works here (http://www.dcs.ex.ac.uk/~aba/rsa/story.html)

PERL HACKERS: The quest for most diminutive munitions program (http://www.dcs.ex.ac.uk/~aba/rsa/story.html).

How to use the program

  • Encrypting / decrypting with perl-rsa (http://www.dcs.ex.ac.uk/~aba/rsa/rsa-details.html)
  • Generating RSA keys (http://www.dcs.ex.ac.uk/~aba/rsa/rsa-keygen.html)
  • Using PGP keys (http://www.dcs.ex.ac.uk/~aba/rsa/pgpacket.html) with perl-rsa
  • If you know perl here’s a break down of how the program works (http://www.dcs.ex.ac.uk/~aba/rsa/story.html).

How to become an Arms Trafficker

Become an Arms-Trafficker (http://online.offshore.com.ai/arms-trafficker/) in one easy step with this great way to register your protest of ITAR by Vince Cate (http://www.offshore.com.ai/vince/). Just click to submit the form and join in the protest. Lots of excellent links. Have you exported RSA today? Includes an option to email a protest letter to Bill Clinton.

The tattoo of the sig

  • Guess that’s the end of any foreign trips for them :-)

The T-shirt of the sig

  • The above code on a T-shirt. Get your munitions-T (http://www.obscura.com/~shirt/) here.This T-shirt may be technically illegal to export from the US.

Fun with HTML

  • exportable inline image (http://www.dcs.ex.ac.uk/~aba/shirt/inline.html) and a sample US page (http://www.obscura.com/~shirt/) using it
  • hypertext reference with the sig in the URL (http://www.dcs.ex.ac.uk/~aba/rsa/link.html)

Media appearances

  • (label) New York Times (http://www.dcs.ex.ac.uk/~aba/rsa/nyt.html) by Peter Lewis (US)
  • (sig) Computer Shopper (http://www.dcs.ex.ac.uk/~aba/rsa/shopper.html) by Charlie Stross (http://www.tardis.ed.ac.uk/~charlie/) (UK)
  • (sig) New Scientist by Wendy Grossman (UK)
  • (shirt) Wired (magazine, US)
  • (shirt) Canal+ TV show Nulle Part Alleurs (France)
  • (shirt) Nova magazine (France)
  • (sig, shirt) Planette Internet magazine (France)
  • (shirt) BBC TV, the Learning Zone (UK)
  • Pictures (http://www.dcs.ex.ac.uk/~aba/shirt/media.html) of the t-shirt in the media

Political/legal background

  • Why it is illegal to export (http://www.dcs.ex.ac.uk/~aba/rsa/legal.html) this 3 line program from the US
  • That weird beast which is the US ITAR (http://www.dcs.ex.ac.uk/~aba/rsa/itar.html) crypto restrictions
  • Phil Zimmermann, author of PGP is the subject of a grand jury investigation for allegedly violating ITAR.
  • Jerome Thorel (http://www.freenix.fr/netizen/)’s page on the sig and shirt (http://www.freenix.fr/netizen/chiffre/perlrsa.html) in the context of the French laws on encryption.
  • Phil Karn (http://www.qualcomm.com/people/pkarn/) is challening the constitutionality of ITAR in court with the amusing Applied Cryptography disk case (http://www.qualcomm.com/people/pkarn/export/).

Other hacks using the perl-rsa code

  • Duncan Frissell’s muntions mailing label (http://www.dcs.ex.ac.uk/~aba/rsa/label.html) was distributed at Computers, Freedom and Privacy ‘95
  • Badge, sold at Sci Fi in Glasgow, Scotland
  • Crypto Sardines (http://www.dcs.ex.ac.uk/~aba/rsa/sardines.html) by Riche (http://www.crl.com/~riche/) (Alex Stewart) and Rui Mendez.
  • Export-a-coke-can (http://www4.ncsu.edu/unity/users/r/rothwell/html/) (tm) the pope. (local copy (http://www.dcs.ex.ac.uk/~aba/rsa/coke-big.gif))
  • International Arms Traffickers page (http://online.offshore.com.ai/arms-trafficker/) by Vince Cate (http://www.offshore.com.ai/vince/).

Other diminutive crypto hacks

  • Vipul Prakash (http://vipul.net) wrote a GOST (http://vipul.net/gost/) in 6 lines of perl
  • Clifford Adams wrote an RSA in pure perl (http://www.dcs.ex.ac.uk/~aba/rsa/pureperl.html) in 5 lines of perl
  • RSA key generation code in perl (http://sea-to-sky.net/~sreid/rsagen.txt) by Steve Reid.
  • RSADSI’s RC4 (http://www.dcs.ex.ac.uk/~aba/rsa/rc4.html) symmetric key stream cipher in 3 lines of PERL
  • Two versions of RC4 in C (http://www.dcs.ex.ac.uk/~aba/rsa/rc4c.html)
  • RSADSI’s RC5 (http://www.dcs.ex.ac.uk/~aba/rsa/rc5.html) symmetric key block cipher in 6 lines of PERL
  • RSADSI’s MD5 (http://www.dcs.ex.ac.uk/~aba/rsa/md5.html) message digest algorithm in 8 lines of PERL5 by John Allen
  • The SHA SHA (http://www.dcs.ex.ac.uk/~aba/rsa/sha.html) message digest algorithm in 8 lines of PERL5 by John Allen
  • Diffie-Hellman (http://www.dcs.ex.ac.uk/~aba/rsa/dh-in-C.html) key exchange in 10 lines of C an anonymous poster
  • Diffie-Hellman in 2 lines of perl (http://www.dcs.ex.ac.uk/~aba/rsa/perl-dh.html) (inspired by anonymous’s C code)
  • IDEA (http://www.dcs.ex.ac.uk/~aba/rsa/idea.html) in 448 bytes of 80x86 by Fauzan Mirza (http://jumper.mcc.ac.uk/~fauzanm/)
  • Andrew Kuchling (http://amarok.magnet.com/) wrote a Python: RSA-in-4-lines-Python (http://www.dcs.ex.ac.uk/~aba/rsa/python.html)
  • One Time Pad (http://www.dcs.ex.ac.uk/~aba/rsa/otp.html) in perl and C
  • Crack (http://www.dcs.ex.ac.uk/~aba/rsa/crack.html) in 1 line of perl by Alec Muffett

Comments, html bugs to me (Adam Back (http://www.dcs.ex.ac.uk/~aba/)) at <aba@dcs.ex.ac.uk>

Original external source

https://web.archive.org/web/19990128131130/http://dcs.ex.ac.uk:80/~aba/rsa/
Adam Back's page at his University of Exeter site, as captured by the Internet Archive on January 28, 1999 (13:11:30 UTC). The page is still published at cypherspace.org/rsa/ with later revisions. Relative links point to their original addresses.