Article View: alt.privacy.anon-server
Article #215859Re: how to find esub if subject and key are known?
From: StealthMonger
Date: Fri, 04 May 2007 12:16
Date: Fri, 04 May 2007 12:16
179 lines
6222 bytes
6222 bytes
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Borked Pseudo Mailed <nobody@pseudo.borked.net> writes:
> can somebody pls explain how to calculate esub if subject and key
> are known
It's the 48 digit hexadecimal code of a number derived according to
the esub algorithm from the given <key> and <subject>. Functions like
mixmaster.ren1.c.t1_esub. The fields of the number can be pictured as
follows:
______________________________________________
| | |
| random iv | encrypt(subject,key,iv) |
| 64 bits | 128 bits |
|_______________|_____________________________|
where "subject" and "key" refer to the 128-bit MD5 hashes of the given
<key> and <subject>, and encryption is computed using IDEA.
Appended below are two pieces of C code, esub.c and exubt.c. Together
with the openssl documentation, they explain the details.
Note that esub uses IDEA, which is patented. For this reason, I have
written variants esubbf.c and esubbft.c which use blowfish instead of
IDEA. New applications should use these instead, but of course they
will not work with the IDEA versions. Source and Debian packages are
available at http://stealthsuite.afflictions.org.
-- StealthMonger
<StealthMonger@nym.alias.net>
<StealthMonger@hod.aarg.net>
<StealthMonger@nym.panta-rhei.eu.org>
--
stealthmail: Scripts to hide whether you're doing email, or when,
or with whom. http://stealthsuite.afflictions.org
*********************
**
** esub.c
**
*********************
#if 0/*
exec gcc -g -o `basename $0 .c` $0 libcrypto.a -lc;*/
#endif
/* Note: Because of the foregoing, an executable can be built from this file
simply by issuing the command ``sh esub.c'' to the shell.
libcrypto.a must include IDEA, which, e.g., Debian libssl0.9.6 does not.*/
/*
SYNOPSIS
esub key sub
DESCRIPTION
Write to stdout a 48-char hex Subject: field derived according
to the esub algorithm from the given key and sub.
Functions like mixmaster.ren1.c.t1_esub.
*/
/*
This code functionally follows that in mixmaster.
output bytes 00-15 are hexified 8-byte iv
output bytes 16-47 are hexified 16-byte ..
*/
#include <stdio.h>
#include <stdlib.h>
#include "idea.h"
#include <openssl/md5.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
void print8(unsigned char id[])
{
printf
("%02x%02x%02x%02x%02x%02x%02x%02x",
id[0], id[1], id[2], id[3], id[4], id[5], id[6], id[7]);
}
int main(int argc, char **argv)
{
IDEA_KEY_SCHEDULE ks;
int n=0, randfd;
char keyd[16], subd[16], tsvd[16], iv[8];
if ( argc != 3 ) return 1;
MD5(argv[1],strlen(argv[1]),keyd);
idea_set_encrypt_key(keyd, &ks);
MD5(argv[2],strlen(argv[2]),subd);
randfd = open("/dev/random", O_RDONLY);
read(randfd, iv, 8);
print8(iv);
idea_cfb64_encrypt(subd, tsvd, 16, &ks, iv, &n, IDEA_ENCRYPT);
print8(tsvd);
print8(&tsvd[8]);
return 0;
}
*********************
**
** esubt.c
**
*********************
#if 0/*
exec gcc -g -o `basename $0 .c` $0 libcrypto.a -lc;*/
#endif
/* Note: Because of the foregoing, an executable can be built from this file
simply by issuing the command ``sh esubt.c'' to the shell.
libcrypto.a must include IDEA, which, e.g., Debian libssl0.9.6 does not.*/
/*
SYNOPSIS
esubt key sub test
DESCRIPTION
If key is an esub key, sub the subject, and test the Subject: field
of an a.a.m posting, return 0 if it's a hit, else 1.
A succinct statement of the functionality is that
esubt key sub $(esub key sub) ; echo $?
gives 0. However, "esub key sub" gives a 48-digit number
which appears random, even with fixed key and sub.
*/
//---------------------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include "idea.h"
#include <openssl/md5.h>
//---------------------------------------------------------------------------
int scanbytes(const char* buf, unsigned char* bytes, const int count)
{
int i;
char s[]="0xxx" , *eptr;
for (i = 0; i < count; i++) {
s[2] = *(buf + 2*i) ;
s[3] = *(buf + 2*i + 1) ;
eptr = &s[0];
*(bytes + i) = (unsigned char) strtol(s, &eptr, 16);
if ( eptr == &s[0] ) return 1;
};
return 0;
}
int main(int argc, char **argv)
{
IDEA_KEY_SCHEDULE ks;
int n=0;
char keyd[16], subd[16], tsu[24], tsvd[16];
if ( argc != 4 || strlen(argv[3]) != 48 ) return 1;
if ( scanbytes(argv[3],tsu,24)) return 1;
MD5(argv[1],strlen(argv[1]),keyd);
idea_set_encrypt_key(keyd, &ks);
idea_cfb64_encrypt(&tsu[8], tsvd, 16, &ks, tsu, &n, IDEA_DECRYPT);
MD5(argv[2],strlen(argv[2]),subd);
return (memcmp(subd, tsvd, 16) == 0 ? 0 : 1);
}
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8+ <http://mailcrypt.sourceforge.net/>
iD8DBQFGOvniDkU5rhlDCl4RAhSvAJ0WCPuNZvfiEIT5IAx2QgsnupCXQgCcDTo7
1y1H0lzsKEBfQDYGcr0uYEU=
=cjE4
-----END PGP SIGNATURE-----
Technical Details
Message-ID:
<200705041216.l44CGPfL025174@marco.aarg.net>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.privacy.anon-server.20141023.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!newsfeed0.kamp.net!newsfeed.kamp.net!feeder3.cambrium.nl!feeder1.cambrium.nl!feed.tweaknews.nl!news.wiretrip.org!news.dizum.com!sewer-output!mail2newsReferences:
<5ddf0071d744395234c32a746bcb4af6@pseudo.borked.net>Show Full Headers
Complete Article Headers
Message-ID: <200705041216.l44CGPfL025174@marco.aarg.net> Subject: Re: how to find esub if subject and key are known? Date: Fri, 4 May 2007 05:16:25 -0700 From: StealthMonger <Use-Author-Supplied-Address-Header@[127.1]> References: <5ddf0071d744395234c32a746bcb4af6@pseudo.borked.net> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.privacy.anon-server.20141023.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!newsfeed0.kamp.net!newsfeed.kamp.net!feeder3.cambrium.nl!feeder1.cambrium.nl!feed.tweaknews.nl!news.wiretrip.org!news.dizum.com!sewer-output!mail2news Author-Supplied-Address: StealthMonger <AT> hod <DOT> aarg <DOT> net Newsgroups: alt.privacy.anon-server X-Virus-Status: Clean Mail-To-News-Contact: abuse@dizum.com Organization: mail2news@dizum.com Lines: 179