Generate SRI HASH
Takes a url to a .js or .css file and replaces it with a script tag including hash.
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
To run the extension:
- Select the url
- Open the command palette (
Ctrl + ⇧Shift + P windows,
⇧⌘P mac) then start to type
- You will see options for SHA-256, SHA-384, or SHA-512. Select one of them
- After a few seconds the url will be replaced inline with the script tag
The extension will fetch the file, then produce a hash of its contents. The time it takes to generate the hash will depend on your available bandwidth and the size of the target file.
This extension is based on the code running at https://www.srihash.org/