Last active
April 20, 2017 17:56
-
-
Save aortbals/ca8812e19d1093b37ff23c6da17112a7 to your computer and use it in GitHub Desktop.
Generate a sha256-base64 string for a content security policy
This file contains 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
#!/usr/bin/env node | |
const crypto = require('crypto'); | |
if (!process.argv[2]) { | |
console.log('Usage: csp-sha <string>'); | |
process.exit(); | |
} | |
console.log(crypto.createHash('sha256').update(process.argv[2]).digest('base64')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment