Skip to main content

HTML create integrity hash for js javascript

Generate SRI hash with shell command

cat FILENAME.js | openssl dgst -sha512 -binary | openssl base64 -A

Generate SRI with PHP

<?php 
$data = file_get_contents("https://URLtoJS.js");
echo base64_encode(hash("sha256", $data, true));
?>

Online
zinoui.com/tools/sri-generator