From: Andrew Loewenstern <andrew_loewenstern@il.us.swissbank.com>
To: “P. J. Ponder” <ponder@freenet.tlh.fl.us>
Message Hash: 5484dded930c373c0d1c725e89bffab70152619bc83ebe9b0062b81a07a2bba9
Message ID: <9609051609.AA00717@ch1d157nwk>
Reply To: <Pine.OSF.3.91.960905084320.30700A-100000@fn3.freenet.tlh.fl.us>
UTC Datetime: 1996-09-06 11:01:36 UTC
Raw Date: Fri, 6 Sep 1996 19:01:36 +0800
From: Andrew Loewenstern <andrew_loewenstern@il.us.swissbank.com>
Date: Fri, 6 Sep 1996 19:01:36 +0800
To: "P. J. Ponder" <ponder@freenet.tlh.fl.us>
Subject: Message Digest Ciphers (was Re: rc2 export limits..)
In-Reply-To: <Pine.OSF.3.91.960905084320.30700A-100000@fn3.freenet.tlh.fl.us>
Message-ID: <9609051609.AA00717@ch1d157nwk>
MIME-Version: 1.0
Content-Type: text/plain
P J Ponder writes:
> How can I use SHA to encrypt something for someone else to
> decrypt? I know how to use it for authentication; am I missing
> something here?
Check Applied Cryptography for info on ciphers such as "Karn",
"Luby-Rackoff", and "MDC" ... These are encryption algorithms that use
one-way hashes as their block functions.
Attached is a version of the Karn cipher I implemented as an
export-a-crypt-system .sig a while back... I used python because it's my
favorite language and has MD5 built-in. I implemented the Karn cipher since
it was the simplest (and therefore shortest) of the MD ciphers, not because
it's the most secure.
andrew
#!/usr/local/bin/python -- -export-a-crypt-system MD5 CBC-mode Karn Cipher
from md5 import *;from sys import *;from string import *;M=md5;il=ir=M(argv[3]\
).digest();ki=M(argv[2]).digest();K,k=ki[:8],ki[8:];p=stdin.read(32);c={'-e':'\
l=x(l,il);r=x(r,ir);R=x(M(l+K).digest(),r);L=x(M(R+k).digest(),l);il=L;ir=R','\
-d':'L=x(M(r+k).digest(),l);R=x(M(L+K).digest(),r);L=x(L,il);R=x(R,ir);ir=r;il\
=l'};main="def x(a,b):return joinfields(map(lambda m,n:chr(m^n),map(lambda m:o\
rd(m),a),map(lambda m:ord(m),b)),'');\nwhile(p):p=ljust(p,32);l,r=p[:16],p[16:\
];exec(c[argv[1]]);stdout.write(L+R);p=stdin.read(32)";exec(main)
#try: echo 'TESTING 1 2 3' | karn -e 'key' 'I-V' | karn -d 'key' 'I-V'
Return to September 1996
Return to ““Perry E. Metzger” <perry@piermont.com>”