Was ist SRI Hash Generator?
Subresource Integrity (SRI) is a browser security feature that verifies the content of external scripts and stylesheets. You add an integrity attribute to your script or link tag containing a cryptographic hash of the file. Before executing the file, the browser computes its hash and compares it to the integrity value. If the hashes do not match — because the file was modified, compromised, or corrupted — the browser blocks the resource.
Kurze Antwort
Use Subresource Integrity (SRI) to protect your site from compromised CDN files. Generate a cryptographic hash of the file content, add the integrity attribute to your script or link tag, and include crossorigin='anonymous'. The browser blocks the resource if its actual hash does not match.
Einschränkungen
- SRI only verifies the file content at load time. It does not protect against vulnerabilities within the loaded library itself (like XSS in an outdated jQuery version). Always keep libraries updated.
- The hash must be regenerated every time the remote file changes. If you forget to update the integrity attribute after a library update, the resource is blocked and the page may break.
- SRI does not work with resources that require credentials (cookies, HTTP auth) from a different origin. For credentialed cross-origin requests, use crossorigin='use-credentials' instead of 'anonymous'.
So nutzt du dieses Tool
- Provide the file content by pasting the code directly, uploading the file, or both (pasted content takes priority).
- Select the hash algorithm — SHA-256 is the standard; SHA-384 and SHA-512 are also valid.
- Copy the generated integrity attribute and the complete script or link tag into your HTML.
Wofür du es nutzen kannst
- Add integrity checks to CDN-hosted scripts like jQuery, Bootstrap, or any third-party library.
- Verify that a downloaded library file matches the expected hash before deploying to production.
- Generate integrity attributes for self-hosted assets when using a CDN and subdomain for caching.