Created
April 28, 2025 21:19
-
-
Save mz0/6542fa58491c360feb666edafea23423 to your computer and use it in GitHub Desktop.
Compute integrity_no="sha384-SgOJ...79m7" string for HTML resources
This file contains hidden or 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
#!/bin/sh | |
if [ ! -n "$1" ]; then | |
echo "No file path argument found" | |
elif [ -f $1 ]; then | |
b64=$(sha384sum $1 | grep -o -E '^[a-f0-9]{96}' | xxd -r -p | base64) | |
echo "integrity=\"sha384-${b64}\"" | |
else | |
echo "\"$1\" not found, or is not readable" | |
fi | |
# /usr/local/bin/integrity |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment