Skip to content

miguel-a-calles-mba/csp-hash-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

csp-hash-generator

npm version vulnerabilities

Generate Content Security Policy hash for inline styles and scripts.

Example

const cspHashGen = require('csp-hash-generator');
const cspHashInlineCss = cspHashGen('div{color:red}');
console.log('cspHashInlineCss:', cspHashInlineCss);
// cspHashInlineCss: sha256-f4MzgafDG4q2N8Hfvs1qfK8n78s+CV/8OlLVKgrA4zw=
const cspHashInlineJs = cspHashGen('console.log("test")');
console.log('cspHashInlineJs:', cspHashInlineJs);
// cspHashInlineJs: sha256-uNaYvNbqceDXrfK/UyL1z5bgy31m0ahirB8RD98Fcdk=

About

Generate Content Security Policy hash for inline styles and scripts.

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published