EncryptCodecencryptcodec
Tools/Sri Generator

SRI Hash Generator

Generate Subresource Integrity hashes for scripts and stylesheets. Paste content directly or fetch from a CDN URL to produce a ready-to-use integrity attribute.

All processing happens in your browser — nothing is sent to our servers

What is Subresource Integrity (SRI)?

SRI lets browsers verify that files fetched from CDNs or third-party servers have not been tampered with. You provide a cryptographic hash of the expected content in the integrity attribute. If the fetched file does not match the hash, the browser refuses to execute it — protecting your users from supply-chain attacks, compromised CDNs, and man-in-the-middle injections. The crossorigin="anonymous" attribute is required so the browser can read the response bytes for verification.

How it works
Subresource Integrity (SRI) Hash Generation
01Input

Script or stylesheet content — pasted directly or fetched from a CDN URL

02Encode

Content converted to UTF-8 bytes using TextEncoder — ensures consistent hashing across platforms

03Hash

Web Crypto API computes the digest using SHA-256, SHA-384, or SHA-512 — runs natively in the browser

04Base64

Raw hash bytes Base64-encoded and prefixed with the algorithm name — e.g. sha384-...

05Output

Ready-to-use integrity attribute and complete HTML tag with crossorigin="anonymous"

Spec: W3C Subresource Integrity (SRI), FIPS 180-4 (SHA-2), Web Crypto API

SRI protects against compromised CDNs and supply-chain attacks. If the fetched file doesn't match the hash, the browser blocks execution entirely.

Frequently Asked Questions