Digest Fields by RFC 9530: the Content-Digest and Repr-Digest of a body, and the Want- fields that ask for them.
The library computes sha-256 and sha-512, the two algorithms in RFC 9530's registry that aren't deprecated. RFC 9530 forbids the others wherever an attacker may be involved.
Digest Fields by RFC 9530: the Content-Digest and Repr-Digest of a body, and the Want- fields that ask for them. The library computes sha-256 and sha-512, the two algorithms in RFC 9530's registry that aren't deprecated. RFC 9530 forbids the others wherever an attacker may be involved.
The algorithms in RFC 9530's registry that the library computes: each name in the fields, with its hash.
The algorithms in RFC 9530's registry that the library computes: each name in the fields, with its hash.
(field-value body)(field-value body algorithm-names)The value of a Content-Digest or a Repr-Digest of the body with the
algorithm-names (sha-256 alone by default). The body is text (as
UTF-8), bytes or nil.
For a Content-Digest, the body is the message's body. For a Repr-Digest, it's the whole representation, which only you can give, e.g. the whole file rather than the range of it that a response holds.
(field-value "{\"hello\": \"world\"}")
;; => "sha-256=:X48E9qOokqqrvdts8nOJRJN3OWDUoyWxBf7kbu9DBPE=:"
The value of a Content-Digest or a Repr-Digest of the `body` with the
`algorithm-names` (sha-256 alone by default). The body is text (as
UTF-8), bytes or nil.
For a Content-Digest, the body is the message's body. For a Repr-Digest,
it's the whole representation, which only you can give, e.g. the whole
file rather than the range of it that a response holds.
(field-value "{\"hello\": \"world\"}")
;; => "sha-256=:X48E9qOokqqrvdts8nOJRJN3OWDUoyWxBf7kbu9DBPE=:"(verify message)(verify message
{accepted :algorithms :or {accepted (set (keys algorithms))} :as opts})The outcome of checking the Content-Digest of the message against its
body by the opts, as a map of the :algorithms that matched, or of an
:error.
Every digest by one of the :algorithms in opts (sha-256 and sha-512 by
default) has to match, and there has to be at least one. The :error is
one of these:
The outcome of checking the Content-Digest of the `message` against its body by the `opts`, as a map of the :algorithms that matched, or of an :error. Every digest by one of the :algorithms in `opts` (sha-256 and sha-512 by default) has to match, and there has to be at least one. The :error is one of these: - ::missing, for a message without a Content-Digest - ::malformed, for one that isn't a Dictionary of Byte Sequences - ::unsupported-algorithm, for one without a digest by the :algorithms - ::mismatch, for a digest that doesn't match the body, with its :algorithm
(wanted s)The names of the algorithms that the Want-Content-Digest or
Want-Repr-Digest s asks for and the library computes, most wanted
first. The field is text or field lines.
(wanted "sha-512=3, sha-256=10, unixsum=0")
;; => ["sha-256" "sha-512"]
The names of the algorithms that the Want-Content-Digest or
Want-Repr-Digest `s` asks for and the library computes, most wanted
first. The field is text or field lines.
(wanted "sha-512=3, sha-256=10, unixsum=0")
;; => ["sha-256" "sha-512"](with-content-digest message)(with-content-digest message algorithm-names)The message with a Content-Digest of its body with the
algorithm-names (sha-256 alone by default).
The `message` with a Content-Digest of its body with the `algorithm-names` (sha-256 alone by default).
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |