🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #85538

Re: X-Trace Header Hashing?

#85538
From: Tony
Date: Wed, 05 Jun 2013 20:57
40 lines
2678 bytes
In news.software.nntp, Jesse <jesse.rehmer@blueworldhosting.com> wrote:

>Next question… As SHA is a one-way hash, how do you decode it later, if 
>necessary?  I get that if you have a list of potential values you could 
>hash those and compare the hashes, but what if you don't have the list 
>of potential values, or your source for generating that list no longer 
>exists?

You can't decode hashes.  If you want two way you need to use one of the
encryption libraries instead.  Be warned, the strings you end up with will
be longer.

http://search.cpan.org/~lds/Crypt-CBC-2.22/CBC.pm

You'll need to install the Perl Blowfish libraries too.

Untested,

  use Crypt::CBC;
  use MIME::Base64;

  $cipher = Crypt::CBC->new( -key    => 'my secret key',
                             -cipher => 'Blowfish'
                            );

    if (hdr->{'X-Trace'} =~ m/^(\S+)\s+(.*)/)
    {
      $info .= $1; #
      $cyphertext = $cipher->encrypt($hdr{'X-Trace'});
      $cyphertext = encode_base64($cyphertext);
      $hdr{'X-Trace'}=$1 . ' ' . $cyphertext;
    }

    $modify_headers = 1;
-- 
Tony Evans
Saving trees and wasting electrons since 1993
blog  -> http://perceptionistruth.com/
books -> http://www.bookthing.co.uk/
[ anything below this line wasn't written by me ]
Technical Details
Message-ID: <koo8mu$35r$1@matrix.darkstorm.co.uk>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.dca3.giganews.com!border2.nntp.dca3.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!news.bbs-scene.org!news.unit0.net!matrix.darkstorm.co.uk!.POSTED!not-for-mail
References: <koisur$usg$1@nnrp.blueworldhosting.com> <koj52n$i2d$1@matrix.darkstorm.co.uk> <slrnkqrclv.ceu.steve@snorky.mixmin.net> <koo5ho$bdq$1@nnrp.blueworldhosting.com>

Show Full Headers
Complete Article Headers
Message-ID: <koo8mu$35r$1@matrix.darkstorm.co.uk>
Subject: Re: X-Trace Header Hashing?
Date: Wed, 05 Jun 2013 21:57:33 +0100
From: Tony <tony@darkstorm.invalid>
References: <koisur$usg$1@nnrp.blueworldhosting.com> <koj52n$i2d$1@matrix.darkstorm.co.uk> <slrnkqrclv.ceu.steve@snorky.mixmin.net> <koo5ho$bdq$1@nnrp.blueworldhosting.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.dca3.giganews.com!border2.nntp.dca3.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!news.bbs-scene.org!news.unit0.net!matrix.darkstorm.co.uk!.POSTED!not-for-mail
Newsgroups: news.software.nntp
Organization: Organised? Me? Nah!
Lines: 40
Reply-To: tony@darkstorm.co.uk
NNTP-Posting-Host: 2MhtC4TZt9eOTJuS6JTz0L6ifsf94myEPLymqbaqD2k=
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: matrix.darkstorm.co.uk aSD//IY6+udkVvUQ0+9rwpIcW+vcfjR2ULHnYTRzvMY==
X-Complaints-To: abuse@matrix.darkstorm.co.uk
NNTP-Posting-Date: Wed, 5 Jun 2013 20:57:02 +0000 (UTC)
X-User-ID: 57ZC41n64AdrXhgSwnQLra71yFH4SeZus1z16mntJtw=
X-Newsreader: Forte Agent 6.00/32.1186
X-Original-Bytes: 2465