Subresource Integrity Generator
Hash a script or a stylesheet in the browser and copy theintegrity value. The default hash is SHA-384.
The file never leaves the browser. Nothing is uploaded.
Hashing the bytes of . The text box is paused until you clear it.
Options
The URL can be stored in the address bar when it is short and has no spaces or quotes. The file contents are not stored there. The hash choice and the tag kind are stored too.
No hash
Integrity
When more than one hash is listed, they are separated by a space, weakest first. The browser uses the strongest algorithm present.
Tag
Same hash with openssl
Replace FILENAME.js with the file. The page does not run this command.
About this tool
Subresource Integrity is the integrity attribute on ascript or a link. The value is a prefix, a hyphen, and the base64 hash of the file. The prefixes this page writes are sha256, sha384, and sha512. The default is SHA-384. All three, when you ask for them, are joined with a space in that order. The browser uses the strongest algorithm that is present.
Text in the box is hashed as UTF-8. A file you open is hashed as its raw bytes, up to 2 MB. The tag is a script src or alink rel="stylesheet", and it always includescrossorigin="anonymous". A URL with a space, a quote, or a bracket is not placed in the tag. You still get the integrity value. Cross-origin files need CORS as well as that attribute. The page does not fetch the URL.
The openssl line is the same pipeline MDN prints for a file on disk:openssl dgst with -binary, thenopenssl base64 -A. It is there so you can check a hash outside the browser. This page builds the integrity attribute. A CSP hash in a script-src header is a different value, for an inline script.
Read more
Free books, courses, and software
Get my programming books, course editions, and complete software.
Get the download library →