24 lines
558 B
Plaintext
24 lines
558 B
Plaintext
|
#!/bin/bash
|
||
|
usage="Usage: $(basename "$0") URL
|
||
|
Generate the subresource integrity hash (SRI) of URL.
|
||
|
|
||
|
--help display this help and exit"
|
||
|
|
||
|
seed=42
|
||
|
while getopts ':hs-help:' option; do
|
||
|
case "$option" in
|
||
|
h) echo "$usage"
|
||
|
exit
|
||
|
;;
|
||
|
:) printf "missing argument for -%s\n" "$OPTARG" >&2
|
||
|
echo "$usage" >&2
|
||
|
exit 1
|
||
|
;;
|
||
|
\?) printf "illegal option: -%s\n" "$OPTARG" >&2
|
||
|
echo "$usage" >&2
|
||
|
exit 1
|
||
|
;;
|
||
|
esac
|
||
|
done
|
||
|
echo sha384-$(curl -s $1 | openssl dgst -sha384 -binary | openssl enc -base64 -A)
|