🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.privacy.anon-server
Article #252421

Re: New Hsub Finder Procedure

#252421
From: StealthMonger
Date: Sat, 17 Dec 2011 17:00
258 lines
9931 bytes
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Kulin Remailer <remailer@reece.net.au> writes:

> if i can find a good explanation of how esub is created, i would
> build one of these scripts for esub as well, if at all possible.

Maybe the comments (or even the code itself) to my blowfish variants
of the esub software would help?  Appended below.

esub is the same except it uses IDEA instead of blowfish.  I have code
for that, too, but it would require some sanitizing.

#if 0/*
exec gcc -g -o `basename $0 .c` $0 -lcrypto -lc;*/
#endif
/* Note:  Because of the foregoing, an executable can be built
   simply by issuing the command ``sh esubbf.c'' to the shell.

SYNOPSIS
        esubbf <key> <subject>

DESCRIPTION

        Write to stdout the 48 digit hexadecimal code of a number
        derived according to the esubbf algorithm from the given <key>
        and <subject>.  Functions like mixmaster.ren1.c.t1_esub except
        that it uses Blowfish instead of IDEA, avoiding patent issues.
        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 by
        BF_cfb64_encrypt(3).

SEE ALSO
        esubbft

*/

#include <stdio.h>
#include <stdlib.h>
#include <openssl/md5.h>
#include <openssl/blowfish.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)
{
  BF_KEY 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);
  BF_set_key(&ks, 16, keyd);
  MD5(argv[2],strlen(argv[2]),subd);
#if defined(__linux__)
  randfd = open("/dev/urandom", O_RDONLY);
#elif defined (__OpenBSD__)
  randfd = open("/dev/srandom", O_RDONLY);
#else
  /* FIXME */
  equivalent_for_your_architecture;
#endif
  read(randfd, iv, 8);
  print8(iv);
  BF_cfb64_encrypt(subd, tsvd, 16, &ks, iv, &n, BF_ENCRYPT);
  print8(tsvd);
  print8(&tsvd[8]);
  return 0;
}

#if 0/*
exec gcc -g -o `basename $0 .c` $0 -lcrypto -lc;*/
#endif
/* Note:  Because of the foregoing, an executable can be built
   simply by issuing the command ``sh esubbft.c'' to the shell.

SYNOPSIS
        esubbft <key> <subject> <test>

DESCRIPTION
        Return 0 if <test> might have been the result of running
        "esubbf <key> <subject>", else 1.  A succinct statement of the
        functionality is that

          esubbft <key> <subject> $(esubbf <key> <subject>) ; echo $?

        gives 0.

SEE ALSO
        esubbf

*/

#include <stdio.h>
#include <stdlib.h>
#include <openssl/md5.h>
#include <openssl/blowfish.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)
{
  BF_KEY 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);
  BF_set_key(&ks, 16, keyd);
  BF_cfb64_encrypt(&tsu[8], tsvd, 16, &ks, tsu, &n, BF_DECRYPT);
  MD5(argv[2],strlen(argv[2]),subd);
  return (memcmp(subd, tsvd, 16) == 0 ? 0 : 1);
}

#!/bin/sh

# SYNOPSIS
#          esubbft-arthdr key sub

# DESCRIPTION
#          Returns the result of calling esubbft key sub test, where
#          test is a ^Subject: field found on standard input.  Useful
#          as a procmail test when fed the header of a candidate
#          article.
esubbft $1 $2 $(sed -n 's/^Subject: //Ip')


ESUBBF(1)                                                            ESUBBF(1)



NAME
       esubbf, esubbft, esubbft-arthdr - compute or test an encrypted subject

SYNOPSIS
       esubbf key subject
       esubbft key subject esub
       esubbft-arthdr key subject

DESCRIPTION
       Compute or test a so-called "encrypted subject" for use in a news arti-
       cle posted on USENET newsgroup alt.anonymous.messages.  This is random-
       looking 48-digit hexadecimal number which is supposed to be efficiently
       recognizable, but only with knowledge of the subject and key.

       These programs are intended for use in shell scripts and  would  rarely
       be used interactively from the keyboard.

       For  all three programs, subject and key are the subject to encrypt and
       the key with which to encrypt it.

       esubbf computes and writes to stdout an  encrypted  subject  using  the
       given subject and key plus a crytographically-strong random number.

       esubbft tests the given encrypted subject esub and returns success code
       0 if esub could have resulted from the given subject and key,  else  it
       returns failure code 1.

       esubbft-arthdr  is a simple script which applies esubbft to the content
       of the first Subject: line found on stdin.  It is useful as a test in a
       procmail(1) script.

       The algorithm for computing an encrypted subject is identical with that
       of the "classic" esub (see HISTORY below) except that it uses  Blowfish
       encryption instead of IDEA (which is patented).  The 48-digit encrypted
       subject encodes a 64-bit random IV followed by the  128-bit  result  of
       encrypt(subject,key,IV).   The  intention is that it not be feasible to
       determine subject or key from esub, or to determine if two esubs  could
       have resulted from the same subject and key.

HISTORY
       "Encrypt Subject" was discussed by Andy Dustman in 1997 on the remailer
       operators mailing list.  He wrote that "it allows you to encrypt a hash
       of the subject using a secret key, thus making the subject appear to be
       a random-looking string of 48 hex digits which is different  each  time
       (due to IDEA-CFB encryption).  It's intended for nym reply blocks which
       point to alt.anonymous.messages."  By 1999 it had been incorporated  by
       RProcess    into    the    widely-used    Reliable    remailer.     See
       http://www.skuz.net/potatoware/esubplug.html.  An  error  in  an  early
       implementation was worked out on the remailer operators mailing list in
       dialogue between RProcess and Ulf in 1999.  A noteworthy remark by  Ulf
       at this time was "The idea of esub is that each message has a different
       Subject header and only the person with the key can  check  which  ones
       belong together."

       Working  from  these  sources,  the present author ported the algorithm
       back to its original Unix platform in 2003 for use in  pseudonym  reply
       blocks  to alt.anonymous.messages.  The recent introduction of stealth-
       mail(7), a new application having no need to be  interoperable,  was  a
       fine  opportunity  to break with the original patented IDEA implementa-
       tion.  blowfish(3) was chosen as the replacement because of the  avail-
       ability  of BF_cfb64_encrypt(3), which is the mode of the original IDEA
       implementation.

SEE ALSO
       blowfish(3), procmail(1).

AUTHOR
       StealthMonger <StealthMonger@nym.alias.net>



                                 2005 June 14                        ESUBBF(1)

- -- 


 -- StealthMonger <StealthMonger@nym.mixmin.net>
    Long, random latency is part of the price of Internet anonymity.

   anonget: Is this anonymous browsing, or what?
   http://groups.google.ws/group/alt.privacy.anon-server/msg/073f34abb668df33?dmode=source&output=gplain

   stealthmail: Hide whether you're doing email, or when, or with whom.
   mailto:stealthsuite@nym.mixmin.net?subject=send%20index.html


Key: mailto:stealthsuite@nym.mixmin.net?subject=send%20stealthmonger-key
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.9 <http://mailcrypt.sourceforge.net/>

iEYEARECAAYFAk7ssr4ACgkQDkU5rhlDCl4WxwCeJft6JFtmhuts+a8V18OIWMaW
TlMAoLF21TpfVVf+G4ora1pqwEHTBIWF
=9gvM
-----END PGP SIGNATURE-----
Technical Details
Message-ID: <20111217170048.3CA7581460@fleegle.mixmin.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!border1.nntp.ams3.giganews.com!border2.nntp.ams3.giganews.com!border2.nntp.ams2.giganews.com!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!news.mixmin.net!eweka.nl!hq-usenetpeers.eweka.nl!188.40.76.149.MISMATCH!mail2news.mixmin.net!not-for-mail
References: <GE2BSOK140893.2355092593@reece.net.au> <G99AA5SC40893.6938773148@reece.net.au> <3DJLN2N340894.473599537@reece.net.au>

Show Full Headers
Complete Article Headers
Message-ID: <20111217170048.3CA7581460@fleegle.mixmin.net>
Subject: Re: New Hsub Finder Procedure
Date: Sat, 17 Dec 2011 17:00:48 +0000
From: StealthMonger <Use-Author-Supplied-Address-Header@[127.1]>
References: <GE2BSOK140893.2355092593@reece.net.au> <G99AA5SC40893.6938773148@reece.net.au> <3DJLN2N340894.473599537@reece.net.au>
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!border1.nntp.ams3.giganews.com!border2.nntp.ams3.giganews.com!border2.nntp.ams2.giganews.com!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!news.mixmin.net!eweka.nl!hq-usenetpeers.eweka.nl!188.40.76.149.MISMATCH!mail2news.mixmin.net!not-for-mail
Newsgroups: alt.privacy.anon-server
Author-Supplied-Address: StealthMonger<AT>nym<DOT>mixmin<DOT>net
Lines: 259
Injection-Info: mail2news.mixmin.net; mail-complaints-to=abuse@mixmin.net
X-Original-Bytes: 9722