CAP never authorizes.
Tagged SHA-256 content digests over canonical bytes.
Preimages are separator || <<0>> || bytes; the wire form is
sha-256:<43-character unpadded base64url>. Equality consumes every byte
pair through an XOR accumulator and tests only once at the end.
Summary
Functions
Compare fixed-width digest bytes without an early content exit.
Parse a closed tagged digest string.
Hash bytes under a registered domain separator. Unknown domains raise.
Hash arbitrary iodata with SHA-256.
Encode a fixed-width digest in tagged wire form.
Verify a tagged digest against bytes under a registered domain.
Types
@type algorithm() :: :sha256
@type t() :: %CharterAgreementProtocol.Digest{ algorithm: algorithm(), bytes: <<_::256>> }
Functions
Compare fixed-width digest bytes without an early content exit.
@spec from_tagged(term()) :: {:ok, t()} | {:error, CharterAgreementProtocol.Error.t()}
Parse a closed tagged digest string.
Hash bytes under a registered domain separator. Unknown domains raise.
Hash arbitrary iodata with SHA-256.
Encode a fixed-width digest in tagged wire form.
@spec verify_content(atom(), binary(), term()) :: :ok | {:error, CharterAgreementProtocol.Error.t()}
Verify a tagged digest against bytes under a registered domain.