aboutsummaryrefslogtreecommitdiff
path: root/sri-hash
diff options
context:
space:
mode:
Diffstat (limited to 'sri-hash')
-rwxr-xr-xsri-hash34
1 files changed, 0 insertions, 34 deletions
diff --git a/sri-hash b/sri-hash
deleted file mode 100755
index 5979c39..0000000
--- a/sri-hash
+++ /dev/null
@@ -1,34 +0,0 @@
-#/bin/sh
-#
-# SRI Hash Generator
-#
-
-# Parameters
-BASENAME="`basename $0`"
-URI="$1"
-
-# Check
-if [ -z "$URI" ]; then
- echo "usage: $BASENAME <file-or-url>"
- exit 1
-fi
-
-# Get file
-if echo "$URI" | grep -q '^http'; then
- echo "downloading $URI and generating hash..."
- HASH="`curl $URI | openssl dgst -sha384 -binary | openssl base64 -A`"
- echo ""
-else
- if [ -e "$URI" ]; then
- # See https://www.srihash.org/
- HASH="`openssl dgst -sha384 -binary $URI | openssl base64 -A`"
- else
- echo "file not found: $URI"
- exit 1
- fi
-fi
-
-# Generate
-cat <<EOF
-<script src="$URI" integrity="sha384-$HASH" crossorigin="anonymous"></script>
-EOF