initial commit
This commit is contained in:
commit
18995db757
871 changed files with 492725 additions and 0 deletions
19
sri.sh
Executable file
19
sri.sh
Executable file
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
# Copyright (C) 2019 Marius Schellenberger
|
||||
|
||||
HASH="sha256"
|
||||
DIR="templates"
|
||||
FILES="*.css *.js"
|
||||
BINS="*.ico"
|
||||
echo "SRI (subresource integrity) hashes"
|
||||
cd ${DIR}
|
||||
for f in $(ls ${FILES} 2>/dev/null); do
|
||||
grep '^' ${f} | head -c-1 - > tmp
|
||||
mv tmp ${f}
|
||||
printf "%13s: " ${f}
|
||||
echo "${HASH}-$(cat ${f}|openssl dgst -${HASH} -binary|openssl enc -base64 -A)"
|
||||
done
|
||||
for f in $(ls ${BINS} 2>/dev/null); do
|
||||
printf "%13s: " ${f}
|
||||
echo "${HASH}-$(cat ${f}|openssl dgst -${HASH} -binary|openssl enc -base64 -A)"
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue