SRI Hash Generator
WHAT IS SUBRESOURCE INTEGRITY?
Subresource Integrity (SRI) is a security feature through which the browser checks whether resources loaded by a CDN, for example, have been manipulated. To do this, the hash we provide must match the resource.
HOW TO GENERATE SRI HASHES?
In addition to the tool above, you can generate a SRI hash in the following ways:
-
Generate SRI with PHP
<?php
$data = file_get_contents("https://code.jquery.com/jquery-3.4.1.min.js");
echo base64_encode(hash("sha256", $data, true));
// CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=
?> -
Generate SRI with shell command
cat FILENAME.js | openssl dgst -sha384 -binary | openssl base64 -A
BROWSER COMPATIBILITY
Chrome 45+, Firefox 43+, Edge 17+, Safari 11+, Opera 32+
SOCIAL SHARE
Share this tool with friends and colleagues on your favorite social network: