Tools Home
ToolsAAWeb Security

Subresource Integrity (SRI) Hash & Tag Generator

Compute cryptographic SHA-256, SHA-384, and SHA-512 Base64 hashes and generate secure HTML script/link tags for CDN resources locally.

Source Asset Code
Complete HTML Tag Code
<script
  src="https://cdn.example.com/assets/app.min.js"
  integrity=""
  crossorigin="anonymous">
</script>
Selected Cryptographic Hashes
sha384Calculating...
sha512Calculating...
sha256Calculating...

W3C Subresource Standards

Produces strictly compliant base64-encoded digests conforming to official W3C Subresource Integrity Level 1 recommendations.

Client-Side SHA Computations

All binary digesting runs locally on your device via window.crypto.subtle, eliminating network upload risks and third-party sniffing.

Full HTML Snippet Export

Generates ready-to-paste script and link tags complete with crossorigin policies to safeguard CDNs against supply chain tampering.

Technical Reference & Architecture Guide

Subresource Integrity (SRI) Hash & Tag Guide — Reference Guide

Compute cryptographic SHA-256, SHA-384, and SHA-512 Base64 hashes and generate secure HTML script/link tags for CDN resources locally.

Key Parameters & Controls

Hash Algorithmsha256 | sha384 | sha512

Cryptographic digest algorithm recommended by W3C Subresource Integrity standards.

HTML Element Typescript | link

Target HTML tag type with corresponding src or href attribute.

Cross-Origin Policyanonymous | use-credentials

Required crossorigin attribute ensuring CORS-compliant resource fetching.

Resource URLstring

Remote CDN target location configured in the output HTML tag.

Pro Tips & Best Practices

Common Gotchas & Troubleshooting

Verify that your CDN server sends correct Access-Control-Allow-Origin headers matching the crossorigin policy.

Ensure the hash is calculated from the exact final deployed artifact rather than development source code.

Frequently Asked Questions

What is Subresource Integrity (SRI)?▼

SRI is a W3C web security feature enabling browsers to verify that resources hosted on third-party CDNs have not been tampered with.

Are files or code uploaded when generating SRI hashes?▼

No, all cryptographic hashing utilizes window.crypto.subtle directly in your browser without network transfers.

Why is crossorigin='anonymous' required?▼

Without CORS enabled on the asset, browsers will block SRI validation to prevent cross-origin information leakage.

Which hash algorithm should I choose between SHA-256, SHA-384, and SHA-512?▼

SHA-384 is recommended by W3C and widely used by major CDNs like Cloudflare and jsDelivr.

Related Tools & Utilities

All Tools →