2120 shaares
901 private links
901 private links
When I need a CSP Hash?
If you are already implemented the Content-Security-Policy header and want to use inline scripts and/or styles but don't want to use the 'unsafe-inline' directive. Then probably you will see a similar error in DevTools console.
printf "%s" "$(<script.txt)" | openssl sha256 -binary | openssl base64
echo -n "$(<script.txt)" | openssl sha256 -binary | openssl base64