[2014] in cryptography@c2.net mail archive

home help back first fref pref prev next nref lref last post

Re: Crypto for Perl

daemon@ATHENA.MIT.EDU (Antonomasia)
Tue Dec 30 10:31:30 1997

Date: Tue, 30 Dec 1997 09:55:04 GMT
From: Antonomasia <ant@notatla.demon.co.uk>
To: cryptography@c2.net, stephen@iu.net

Stephen,

Using my (perl-driven) archive (mailto:arcbot@notatla.demon.co.uk)
you can find past posts such as those excerpted below.

Remo Pini (rpini@rpini.com) sells a CD which includes a Perl DES
implementation by Eric Young.



file: v03007808af14f4068d59@[139.167.130.246]
from: robert hettinga <rah@shipwright.com>
Date: 20mar1997
Subject: Call for Participants: The Financial Cryptography 1997 Workshop
Keywords: 
-

CALL FOR PARTICIPANTS
The Financial Cryptography 1997 (FC97)
Workshop for Senior Managers and IS Professionals
February 17-21, 1997
The InterIsland Hotel
Anguilla, BWI
<http://www.offshore.com.ai./fc97/>

Workshop Update: January 29, 1997

[snip]

The Principal Instructors

Gary Howland worked on digital cash systems for DigiCash, and then moved to
Systemics, where he developed the SOX protocol, a flexible payments system
currently in use in a bond trading environment, soon to be available to the
public. He also developed the Cryptix and PGP libraries in Perl, and
assisted on the Cryptix and PGP library implementations in Java.

[snip]






file: 199704200759.iaa00552@server.test.net
from: adam back <aba@dcs.ex.ac.uk>
Date: 21apr1997
Subject: Re: The unmentionable algorithm
In Reply To: 199704200502.waa07323@proxy2.ba.best.com
Keywords: 
-

[snip]

I'd vote that RC4 is simpler to implement also.

Here's RC4 in 4 lines of C:

#define S,t=s[i],s[i]=s[j],s[j]=t /* rc4 key <file */
unsigned char s[256],i,j,t;main(c,v)char**v;{++v;while
(s[++i]=i);while(j+=s[i]+(*v)[i%strlen(*v)]S,++i);for(
j=0;c=~getchar();putchar(~c^s[t+=s[i]]))j+=s[++i]S;}

RC4 in perl:

#!/bin/perl -p0777-- export-a-crypto-system-sig -RC4-in-3-lines-perl5
@k=unpack'C*',pack'H*',shift;for(@t=@s=0..255){($y+=$k[$_%@k]+$s[$x=
$_])%=256;&S}$x=$y=0;for(unpack'C*',<>){($y+=$s[($x+=1)%=256])%=256;
&S;print chr($_^=$s[($s[$x]+$s[$y])%256])}sub S{@s[$x,$y]=@s[$y,$x]}

DES in perl:

#!/bin/perl -s-- DES in perl5
$/=" ";sub u{$_=<DATA>;s/\s//g;map{-33+ord}/./g}$"='';$[=1;@S=map{[u]}1..8;@I=
u;@F=u;@C=(split//,unpack B64,pack H16,$k.0 x16)[u];@D=splice@C,29;@p=u;$_=11 .
2222221 x2;for$l(/./g){map{push@$_,splice@$_,1,$l}\@C,\@D;$K[++$i]="@{[(@C,@D)
[@p]]}"}@E=u;@P=u;%a=map{unpack(B8,chr$_),$_}0..63;while(read STDIN,$b,8){@L=(
split//,unpack B64,$b."\0"x7)[@I];@R=splice@L,33;for$i(1..16){$i=17-$i if$d;@t
=@R[@E];$j=1;$n=0;for(($K[$i]^"@t"|0 x48)=~/.{6}/g){($n<<=4)+=${$S[$j++]}[$a{
"00$_"}+1]};@t=(split//,unpack B32,pack N,$n)[@P];@X=split//,"@L"^"@t"|0 x32;
@L=@R;@R=@X}print pack B64,join'',(@R,@L)[@F]}__END__~printunpacku,'$2F%P:```'
/!%0.("%#/0#,.)"$++''--,&**&!$()%0"-/))#.%'*#",(0&-,*$(/$++!&'!. 0$".)%/('0,#$
)%/*-(!#".+-'!*&,+&!./)(+,"+$%0.%"#&,)'-('-*!$&#/0* +.!(*!/*'$$%0'&+"#.)-&(/,-
%,#0)"."'+%.*!)'0*$)!(,%"0#/-$&,+&/#(- (..)/,$&!''0*!+$"%#()#&-,"-+%/0*+$'0*!!
'-+,"(..)0*"%$&/,&-#()#%/ #/-,%#"-(%+(,.'")&&!$00+.$!*/)*'%,#)"-,(+"./(#).0'*0
-!&*'+$%!&/$ -+"0+%0#*(#-'*)&!'."$.%//!(,&$,)*%/$0#&-#*)&-0$+(,!/%"+("'.!,)'. 
%.,!#,/(0%!*)".+$/-$*&(-&#+0')"'"'%,,..)-"$%(+/(+*0&'!)0!/&#*$#- ."#0).%)'+0$,
("%+-*&$'/,&!!/-*(#(#,"%/"(*%-+/)#.!0'-+*.!0$$&&'), [SKC;3+#]UME=5-%_WOG?7/'aY
QIA91)ZRJB:2*"\TLD<4,$^VNF>6.&`XPH@80( I)Q1Y9aAH(P0X8`@G'O/W7_?F&N.V6^>E%M-U5]
=D$L,T4\<C#K+S3[;B"J*R2Z: ZRJB:2*"[SKC;3+#\TLD<4,$]UME`XPH@80(_WOG?7/'^VNF>6.&
=5-% /2,9"&$=0'6+84-%;)1(<5.#JU@FPX?ITNBQMRHYCVOKSE>A A"#$%&%&'()*)*+,-.-./012
12345656789:9:;<=>=>?@A" 1(56>-=2"08;&3@+#)9/A<$*4.?'7,%: <<< DES in perl >>>

As you can see, DES is considerably larger.  The DES is by John Allen
<allen@gateway.grumman.com> and is optimised for size (and
obfuscation).

Adam

-- 
Have *you* exported RSA today? --> http://www.dcs.ex.ac.uk/~aba/rsa/

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`


--
##############################################################
# Antonomasia   ant@notatla.demon.co.uk                      #
# See http://www.notatla.demon.co.uk/                        #
##############################################################

home help back first fref pref prev next nref lref last post