SRI Hash Generator
Generate Subresource Integrity hashes for scripts and stylesheets.Runs in this tab.⌘ ↵ runs it
Next step
AtriumKitFrom the team behind browserutils
Turn a click-through into an interactive demo
AtriumKit records your web app once in Chrome and turns every click into a step of a demo you can embed or share. There’s a free plan.
Try AtriumKit freeAbout SRI Hash Generator
Free online SRI hash generator. Create Subresource Integrity hashes (SHA-256, SHA-384, SHA-512) for script and stylesheet tags to protect against CDN tampering. It runs in your browser. Nothing is sent to a server.
Questions
What is Subresource Integrity (SRI)?
SRI is a security feature that allows browsers to verify that files fetched from CDNs or third-party servers have not been tampered with. You include a cryptographic hash in the integrity attribute of script or link tags, and the browser checks the downloaded file against that hash before executing it.
Which SRI hash algorithm should I use?
SHA-384 is the most commonly used and provides a good balance of security and compatibility. SHA-256 is also widely supported. SHA-512 offers the highest security but is less commonly seen. You can include multiple hashes for fallback compatibility.
How do I add an SRI hash to a script tag?
Add the integrity attribute to your script or link tag, like <script src="..." integrity="sha384-..." crossorigin="anonymous">. The crossorigin attribute is required for SRI to work with resources served from a different origin.
What happens if the SRI hash does not match the file?
The browser blocks the resource from loading entirely. This protects your users from executing tampered code, but it also means your page may break if the CDN serves an updated file. Always update your SRI hashes when you update the library version.
Does the SRI hash generator process my file locally?
Yes. The hash is computed entirely in your browser using the Web Crypto API. The file contents are never sent to any server.
Comments
More in Security & Privacy
- robots.txt Generator
- CSP Header Generator
- Chmod Calculator
- .htpasswd Generator
- SSH Key Generator
- PGP Key Generator
- Password Strength Checker
- CORS Tester
Comments