Skip to content

Instantly share code, notes, and snippets.

@robbat2
Created September 19, 2023 15:58
Show Gist options
  • Save robbat2/d737c958c5bc9481e86c4d313125b2e3 to your computer and use it in GitHub Desktop.
Save robbat2/d737c958c5bc9481e86c4d313125b2e3 to your computer and use it in GitHub Desktop.
gentoo archives mail hash
FORMAIL=/usr/bin/formail
UUID=`/usr/bin/uuidgen`
# inject the salt into the mail
:0 fhw
* H ?? !^X-Archives-Salt
| $FORMAIL -A "X-Archives-Salt: $UUID"
# hash the mail headers, with the salt
HASH=`$FORMAIL -X Received -X Date -X Message-ID -X From -X Subject -X List-Id -X X-Archives-Salt | md5sum | awk '{print $1}'`
# Inject the hash back as a new header
:0 fhw
* H ?? !^X-Archives-Hash
| $FORMAIL -A "X-Archives-Hash: $HASH"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment