The issue

I have a small private Apache2 web server running on Debian 10 Buster with security on my top list. Right now, I'm struggling with:

How to generate in the Linux terminal the base64-encoded sha256 of my CSS style sheet file styles.less for Content Security Policy?

Getting close

The closest I got was thanks to this comment made by sideshowbarker with command:

cat styles.less | openssl dgst -sha256 -binary | base64

So far I only know that this part is ok:

cat styles.less | openssl dgst -sha256

because the output SHA-256 hash sum equals to ordinary sha256sum command, as proved with:

$ cat styles.less | openssl dgst -sha256
(stdin)= 0d1095db21ec5177406ed074dadd59d8298f6f4f9ae870bf8d562feeb081ecb1

$ sha256sum styles.less
0d1095db21ec5177406ed074dadd59d8298f6f4f9ae870bf8d562feeb081ecb1  styles.less

$ openssl version
OpenSSL 1.1.1d  10 Sep 2019

Any ideas welcome. Will be back shortly, be patient with comment replies, thank you.

Getting wrong output:


Chrome says it shall be (I hope I'm getting the right one):


As it might be helpful now, here's the direct link for that style sheet. Hope we solve it soon.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.