Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Build a sub-resource integrity string (js | css). Usage: subresource-integrity
if [ ${1: -4} == ".css" ]; then h="<link href=\"//"$1"\""; f=" rel=\"stylesheet\">"; else h="<script src=\"//"$1"\""; f=" type=\"text/javascript\"></script>"; fi; echo $h" integrity=\"sha256-"`curl -s $1 | openssl dgst -sha256 -binary | openssl enc -base64 -A`" sha512-"`curl -s $1 | openssl dgst -sha512 -binary | openssl enc -base64 -A`"\" crossorigin=\"anonymous\""$f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.