I have my MH's send: set up to generate message IDs itself. send: -msgid
It produces message IDs like: Message-ID: <[EMAIL PROTECTED]> When people reply to me, they often have In-Reply-To: headers, like: In-Reply-To: Message from Michael Richardson <[EMAIL PROTECTED] a> of "Sat, 21 Aug 2004 22:37:08 EDT." <[EMAIL PROTECTED]> (and RFC2822 mandates all of this) What's I'd like to do is to change the message ID generation code such it takes a unique 32-bit value (derive it from time), encrypts it with some minor check built in, and then base64 encodes it into the message-Id. I then want to use pick (maybe eventually procmail) to sort real replies to me into a higher precedence folder. I think that I can code all of this. I just wanted to run the idea by people. I would verify that the message id decrypted is right by encrypting a single block with time|(time^0xffffffff). It produces msgid's like: <[EMAIL PROTECTED]> msgid is good I prototyped it in perl. #!/usr/bin/perl # cryptomsgid.pl use MIME::Base64; use Crypt::DES_EDE3; use Data::Dumper; $Data::Dumper::Useqq = 1; $MAILDIR="$ENV{'HOME'}/Mail"; $msgidfile="$MAILDIR/.msgid"; $msgidkeyfile="$MAILDIR/.msgidkey"; $msgidunique=time(); if(open(MSGID, "$msgidfile")) { chop($lastmsgid=<MSGID>); if($msgidunique <= $lastmsgid) { $msgidunique = $lastmsgid+1; } close(MSGID); } open(MSGID, ">$msgidfile") || die "Can not write to $msgidfile: $!\n"; print MSGID $msgidunique."\n"; close(MSGID); if(open(KEYFILE, "$msgidkeyfile")) { #print STDERR "Reusing old keyfile\n"; sysread(KEYFILE, $key, 24); close(KEYFILE); } else { open(KEYFILE, "/dev/random") || die "can not open /dev/random: $!\n"; open(KEYFILE2, ">$msgidkeyfile") || die "can not write to $msgidkeyfile: $!\n"; sysread(KEYFILE, $key, 24); syswrite(KEYFILE2, $key, 24); close(KEYFILE); close(KEYFILE2); } my $ede3 = Crypt::DES_EDE3->new($key); $invert = ($msgidunique ^ 0xffffffff); #printf(STDERR "msgid: %08x invert: %08x\n",$msgidunique, $invert); $block = pack("NN", ($msgidunique & 0xffffffff), ($invert & 0xffffffff)); #print STDERR "plain: ".Dumper($block); $newblock = $ede3->encrypt($block); #print STDERR "enc: ".Dumper($newblock); $base64 = MIME::Base64::encode($newblock."|", ""); #print STDERR "base64: ".Dumper($base64); chop($hostname=`hostname`); print "<[EMAIL PROTECTED]>\n"; === #!/usr/bin/perl # checkmsgid.pl use MIME::Base64; use Crypt::DES_EDE3; use Data::Dumper; $Data::Dumper::Useqq = 1; $MAILDIR="$ENV{'HOME'}/Mail"; $msgidfile="$MAILDIR/.msgid"; $msgidkeyfile="$MAILDIR/.msgidkey"; open(KEYFILE, "$msgidkeyfile") || die "No message key file: $msgidkeyfile\n"; sysread(KEYFILE, $key, 24); close(KEYFILE); my $ede3 = Crypt::DES_EDE3->new($key); chop($hostname=`hostname`); while(<>) { chop; $all = $_; if(/.*\<(.*)[EMAIL PROTECTED]>.*/) { $id = $1; # verify it #print STDERR "ID: ".Dumper($id); $decoded = MIME::Base64::decode($id); if(substr($decoded, 8, 1) != "|") { print "$all is trivially not valid\n"; next; } $encblock = substr($decoded, 0, 8); #print STDERR "ENC: ".Dumper($encblock); $plainblock=$ede3->decrypt($encblock); #print STDERR "plain: ".Dumper($plainblock); ($msgidnum, $msgidinvert) = unpack("NN", $plainblock); $msgid2 = $msgidinvert ^ 0xffffffff; #printf(STDERR "msgidnum: %08x invert: %08x (%08x)\n", # $msgidnum, $msgidinvert, $msgid2); if($msgidnum == $msgid2) { print "$all msgid is good\n"; } else { print "$all msgid is bad\n"; } } else { print "$all is not formatted correctly\n"; } } _______________________________________________ Nmh-workers mailing list [EMAIL PROTECTED] http://lists.nongnu.org/mailman/listinfo/nmh-workers
