Created
February 1, 2016 14:58
-
-
Save anonymous/e05e0ff71993d6a6d757 to your computer and use it in GitHub Desktop.
Build a sub-resource integrity string (js | css). Usage: subresource-integrity cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-beta1/jquery.min.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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