SRI Hash Generator

Generate Subresource Integrity hashes so browsers refuse to run a CDN script or stylesheet that's been altered. Paste the file's contents or drop the files, choose SHA-256, SHA-384 or SHA-512, and copy the integrity value or a complete <script> or <link> tag.

Integrity format

PartExample
Algorithm prefixsha384-
DigestBase64 of the raw hash bytes
Multiplesha256-… sha384-…

When to use it

  1. Pin a CDN-hosted library to an exact version.
  2. Protect against a compromised CDN or supply-chain attack.
  3. Add integrity to stylesheets and scripts in a release.
  4. Satisfy a security audit or CSP require-sri-for policy.

How to Use

  1. Choose the algorithms.
  2. Paste content or drop files.
  3. Copy the integrity value or full tag.

Features

  1. SHA-256, 384, 512
  2. Multiple hashes
  3. Script and link tags
  4. crossorigin included
  5. Batch files
  6. No upload

FAQs

What is Subresource Integrity?

An integrity attribute with a hash; the browser blocks the file if its contents don't match.

Which algorithm should I use?

SHA-384 is the usual choice. You can include several.

Why does my hash not match the CDN's?

You must hash the exact bytes served — different line endings, minification or versions change the hash.

Do I need crossorigin?

Yes, for files from another origin, and the CDN must send Access-Control-Allow-Origin.

Are my files uploaded?

No. They're hashed in your browser.

Technical Details

The exact bytes of the file — or the pasted text encoded as UTF-8 — are hashed with the browser's Web Crypto SHA-256, SHA-384 or SHA-512, and the raw digest (not its hex form) is Base64-encoded and prefixed with the algorithm, e.g. sha384-…, as the W3C Subresource Integrity specification requires. Several algorithms can be listed in one integrity attribute; browsers use the strongest they support. The tag builder adds crossorigin="anonymous", which cross-origin resources need for the browser to check integrity at all, and picks <link rel="stylesheet"> for .css URLs and <script> otherwise. Files and folders can be dropped for batch hashing.

Security Tools

Security Tools

  • Permissions-Policy Builder
  • htpasswd Generator
  • Common Port Reference
  • Google Dork Generator
  • Google Search Operators
  • CRC Generator
  • Vigen\u00e8re Cipher
  • TOTP Generator