The digest is over the response body, exactly
integrity="sha384-..." is the base64 of the SHA-384 digest of the decoded response body: not the compressed bytes on the wire, not the file on disk before minification, not the same file with a different line ending. A build that changes a single byte changes the digest, and a server that re-encodes or rewrites a file in flight will fail the check for everyone. That is why the page takes the artefact, hashes it, and never fetches the URL: the only bytes that matter are the ones the browser will receive.
All three algorithms are computed so you can see the bit lengths side by side: 32, 48 and 64 bytes. A browser uses the strongest algorithm in the attribute that it supports, so an attribute with two tokens is a hedge for a client that lacks one of them, not a second chance at matching.
Cross-origin, and the CORS dependency nobody mentions
To check integrity a browser has to read the body of the response, and for a cross-origin request that means the response must be readable under CORS. Concretely: crossorigin="anonymous" on the tag, and Access-Control-Allow-Origin on the response. Without both, the fetch fails before the digest is compared, and the console message is a CORS error rather than an integrity error, which sends people looking in the wrong place.
Same-origin scripts need no crossorigin and no CORS header. A script served from your own origin with integrity is the simplest correct setup, and it is worth preferring for a critical library.
What an integrity attribute cannot do
It pins a file; it does not vouch for it. A hash you generated from a compromised build is a perfect pin on a malicious file. It also does not survive everything: a dynamic import() of a URL, eval, a blob URL, or a service worker that rewrites the response all step outside the attribute's reach in most browsers. And it does not cover the page around the script, so an XSS in your own code is unaffected by any of it.
For inline script there is no attribute at all, which is why the CSP hash exists: script-src 'sha384-...' allows exactly that inline text and nothing else. That is the only form in which a hash binds an inline block.
SRI and a Content-Security-Policy are different tools
Integrity protects the bytes of one resource from being swapped. A policy decides which resources may load at all. A host allowlist is broad: every path on that host is allowed. A hash is narrow: one file, exactly. In practice the durable pattern for external scripts is a host allowlist plus 'strict-dynamic', with an integrity attribute on each pinned script as a second lock, and hashes for the inline bootstrap that has to exist.
The policy line this page writes is a correct hash source for the element you built. It is not a complete policy: a real one also names default-src, object-src 'none', base-uri and the rest, and it needs testing with a report-only pass before enforcement.
Verifying a claim you were given
The verify tab exists for the moment a vendor hands you an integrity attribute and a file. Paste both and the page computes the three digests and compares each token, naming the algorithm that matched and the one that did not. A common failure is a file that was re-saved with CRLF line endings or a trailing newline added by an editor, and the per-algorithm report is what turns "it does not work" into "the bytes differ".
The same digests without the tag are on Pikkola Hash. The full policy around them is on Pikkola CSP.