Knowledge base

digest

Compute a hash
An auxiliary calculation

Computes a string hash with HMAC-SHA256 or SipHash and a key — a string (–key) or a hexadecimal value (–hexkey).

Useful where values are compared by hash — for example, to check a value computed by another system with the same algorithm and key.

The limits are named in the manual: the algorithms and the key forms are mutually exclusive; for SipHash the key is up to 16 bytes — a shorter one is padded with zero bytes, a longer one is not accepted.

The main trap is comparing with a hash of another kind. The command prints a hexadecimal string; a value encoded differently or computed with another key will not match it, even if the source string is the same.
What the Hub does. It does not call it.
Recommended values

When to call it:

Question This command or not
HMAC-SHA256 of a string with a key yes — –hmac-sha256
a short SipHash hash yes — –siphash, a key up to 16 bytes
verify a message signature no
The algorithms, the key forms and the SipHash limits come from the manual (§ 6.3.32). The trap analysis is ours.
Example configuration
# HMAC-SHA256 and SipHash of one string with one key
pmta digest --hmac-sha256 --key=secretkey port25pmta digest --siphash --key=secretkey port25
The manual’s examples: the first line prints 64 hexadecimal characters, the second 16.
yellow — — directive names, blue — blocks. They are highlighted the same way in the text of the card.
Compatibility
PowerMTA 6.0
described in the manual of this version · platform: any
The vendor does not state the first version for every directive — there is no note here. The name also appears in the 5.0 edition of the manual.
How to check on the node
Compare the result with the manual’s example:
pmta digest --hmac-sha256 --key=secretkey port25
For this string the manual gives 614648A140A88192D375C22E606BEC922E8CFA71A5063C067E6BE7CB49C506AA; a different result means a different key or a different string.
In the Hub
Cost of a mistake
safe: a wrong value breaks nothing
Scenarios
Address suppression · Collect telemetry