Since adding Content Security Policies to my website, I need to add a sha for any inline scripts I use - I only use one, which initiates my ServiceWorker.

I keep forgetting how to genetate shas. Making a note for future reference.

You can generate a hash using openssl:

echo -n 'doSomething();' | openssl sha256 -binary | openssl base64

Posted on , by in til notes