Compliance

SRI Hash Generator

Generate subresource integrity hashes so the browser verifies a CDN script has not been altered before executing it.

Last reviewed by the Radiatus Cloud team

SRI Hash Generator

Generate SHA-384 integrity hashes for your <script> and <link> tags.

Going for ISO 27001, SOC 2, HIPAA or GDPR?

Radiatus runs end-to-end compliance & GRC programs.

Get a free readiness review

What SRI protects against

Loading a script from a CDN means executing whatever that host returns, with full access to your page: the DOM, cookies accessible to script, and anything a user types. If the CDN is compromised, or an attacker intercepts the response, they run code as your site. Subresource integrity attaches an expected hash to the tag, and the browser refuses to execute anything that does not match. The Polyfill.io incident, where a widely-used CDN began serving malicious code to hundreds of thousands of sites, is exactly the scenario SRI prevents.

Pin the version, always

SRI hashes a specific file. Pointing at a URL that means latest guarantees the hash will break the moment the file changes, and worse, tempts people to remove the integrity attribute to make the site work again. Always reference an exact version so the content is stable and the hash stays valid.

Crossorigin is required

A cross-origin resource must be fetched with CORS for the browser to read enough of it to verify. Without the crossorigin attribute set to anonymous, the check cannot run and the resource is blocked. Omitting it is the most common reason SRI appears to break a working page.

Choose SHA-384

SHA-256, SHA-384 and SHA-512 are all permitted. SHA-384 is the common recommendation and there is no practical reason to use anything weaker. Multiple hashes may be supplied for the same resource, and the browser accepts the file if any one matches, which is how you roll a version without a moment of breakage.

There is no fallback

If the hash does not match, the resource simply does not load, and a page depending on it breaks completely rather than degrading. That is the correct behaviour for a security control and it means the hash must be right. Generate it from the exact file you will serve, not from a similar one.

Self-hosting is often simpler

SRI mitigates CDN compromise, but hosting the file yourself removes the third party entirely, avoids the extra DNS and TLS handshake, and no longer benefits from cross-site caching, which browsers partitioned years ago for privacy reasons. For most sites the CDN advantage that justified the risk no longer exists.

Related tools

Frequently Asked Questions

What does subresource integrity do?

It attaches an expected hash to a script or stylesheet tag so the browser refuses to execute the file if it has been altered. It is the defence against a compromised CDN serving malicious code.

Why is my SRI check blocking a working script?

Almost always a missing crossorigin attribute. A cross-origin resource must be fetched with CORS for the browser to verify it, so without crossorigin set to anonymous the check cannot run and the file is blocked.

Can I use SRI with a latest version URL?

No. The hash covers one exact file, so a moving URL breaks the moment the content changes, and the usual reaction is to remove the integrity attribute entirely. Pin an exact version.

Which hash algorithm should I use?

SHA-384 is the common recommendation. You can supply several hashes for one resource and the browser accepts a match on any, which lets you roll a version without downtime.

Should I use a CDN at all?

Self-hosting removes the third party entirely and avoids extra DNS and TLS work. Browsers partitioned cross-site caching years ago for privacy, so the shared-cache benefit that justified CDNs largely no longer exists.

Privacy & Security

Local usage.

Data: None
Client-side-Side
Active
v1.0

About This Tool

This tool runs entirely in your browser. No data is sent to any server, ensuring complete privacy. Simply use the interface above to get started — no registration or login required.

Disclaimer: This tool is provided "as is" without warranty of any kind. Results are for educational and utility purposes.