opyeb srihash

No upload, no server

Hashes you can trust,
with the tag and header ready

Subresource Integrity is how you know the script a CDN served is the one you shipped. Open one file and all three digests appear, together with the script or link tag that carries them and the matching CSP line. The same screen explains why an existing tag is being blocked.

Open a file or paste source and the hashes appear here.

0 B

1 · File or source

No URL is fetched. Only the local file or the pasted bytes are hashed.

Text pasted from an editor arrives with LF line endings. If the file on the server is stored with CRLF, turn this on to match the real hash.

2 · SRI hashes

SRI

All three algorithms are computed with Web Crypto (crypto.subtle.digest).

SHA256 sha256-…
SHA384 sha384-…
SHA512 sha512-…

When several hashes are present a browser checks only the strongest, so SHA-384 or better is recommended. A hash covers bytes: one changed line ending or a BOM changes it completely.

3 · Tag and CSP text

integrity is only checked on CORS requests.

The URL only appears in the text and is never requested. The only example domain used is cdn.example.com.

<script> tag
CSP source line

require-sri-for is deprecated. Keep integrity on external files and use CSP source lists for the allowlist.

4 · Paste to validate

— —

Paste a tag, an integrity string, a Content-Security-Policy header or a response header block (Access-Control-Allow-Origin and friends); the type is detected for you. If a file is loaded above, the hash is compared with the actual bytes.

    Examples

    Sample digests were computed with Python hashlib at build time. Load the file sample first to see the match in the tag check.

    How it works

    1. 01File or source

      Drop a local .js or .css file, or paste the source. There is no feature that fetches a URL.

    2. 02Read the digests

      All three Base64 digests appear together, with the byte count and the LF/CRLF difference spelled out.

    3. 03Copy and verify

      Copy the tag or the CSP hash line, then paste an existing tag to check its format, CORS setup and hash match.

    What is on one screen

    Three algorithms in one pass

    Web Crypto's crypto.subtle.digest produces SHA-256 (32 bytes), SHA-384 (48 bytes) and SHA-512 (64 bytes) together. Files are read byte for byte; pasted text is read as UTF-8.

    Line endings and BOM

    The same code stored with LF and with CRLF is a different file. Pasted text arrives with LF, so a toggle re-hashes it as CRLF when the file on the server uses CRLF; the byte difference is shown as a number.

    Tag builder

    Pick integrity, crossorigin (anonymous or use-credentials) and referrerpolicy to get the script or link tag. The URL only appears in the text; it is never requested.

    CSP hash lines

    Generates script-src and style-src hash lines for inline code, and source-allowlist lines for external files. It points you away from the removed require-sri-for directive.

    Existing tag diagnosis

    A pasted tag is checked for algorithm strength, Base64 length, a missing crossorigin (fetched no-cors, so SRI is skipped), use-credentials requirements and mixed content.

    CORS response header check

    Paste the response headers copied from the developer tools and the tool checks Access-Control-Allow-Origin, wildcard and credential combinations, Vary: Origin and the MIME type — catching the responses where SRI never starts.

    CSP syntax checks

    'none' mixed with other values, duplicate directives, unquoted hashes, short nonces and unsafe-inline next to a hash — the mistakes browsers ignore silently.

    Why your code never leaves the page

    To hash a file you need its whole content. The moment you upload it to an online tool, code you have not shipped yet is copied to someone else's server. This tool simply has no such path.

    No upload

    The file is read by FileReader into this browser's memory. Open the developer tools network panel and count zero external requests.

    No storage

    Input and hashes are not saved. A reload clears them; the only thing kept is your theme choice.

    No API

    There is no hashing endpoint and no JSON feed. The whole site is static HTML and JavaScript.

    Questions

    I added the hash and the browser still blocks the file. Why?

    Three usual causes. First, a cross-origin file without crossorigin="anonymous" is fetched no-cors, so the integrity check is skipped or fails. Second, the server does not send Access-Control-Allow-Origin, so the CORS request itself is blocked. Third, the bytes you hashed are not the bytes served (line endings, post-build minification, compression). Paste the tag into the validator and it names the one that applies.

    Which algorithm should I use?

    SRI supports all three, and when several hashes are present a browser checks only the strongest. Use SHA-384 for new values. SHA-1 and MD5 are not supported by SRI, so a resource pinned to them is blocked.

    If I use integrity, do I still need CSP?

    They answer different questions. Integrity asks whether these bytes are the right ones; CSP decides which origins may run code. Use both to cover tampering and origin abuse.

    Can I still use require-sri-for?

    No. It was removed from Chrome and dropped from the standard. Use the integrity attribute on external files and CSP source lists for the allowlist.

    How do I know the hash matches my file?

    Load the file above, then paste the tag or CSP into the validator. It compares the same algorithm's digest with the actual bytes and reports match or mismatch. When it mismatches, suspect line endings first.

    Guides and reference

    Five pieces: how SRI is enforced, choosing between CSP hashes and nonces, why CORS turns into a block, pinning CDN versions against hash drift, and a failure-by-failure diagnosis.

    Browse all guides

    Start with one file

    Load the sample JS and all three hashes and the tag appear at once; try the deliberately wrong tag to see the validator work.

    Start with a sample