Karta. Auth. DKIM. BodyHash
(Karta v1.0.0)
SHA-256 of a body as DKIM canonicalises it (RFC 6376 §3.4.3 and §3.4.4), computed over the body in pieces: a message of any size costs one piece plus one line, never the whole body.
new/1 starts a hash for :simple or :relaxed, update/2 takes the
body's bytes as they arrive — in pieces of any size, with a line break or
a run of white space split across two of them — and finish/1 gives the
digest, which is :crypto.hash(:sha256, Karta.Auth.DKIM.Canonical.body(body, algorithm)).
Only CRLF ends a line, as in Karta.Auth.DKIM.Canonical: a bare CR or LF
is body text. A message whose lines end otherwise is refused for delivery
before it is signed.
Summary
Functions
The canonical body's SHA-256.
A hash in progress for a canonicalisation.
Adds the body's next bytes.