Generate SHA256 hash for SRI (Subresource Integrity)
(content)
| 12 | |
| 13 | |
| 14 | def _generate_sri_hash(content): |
| 15 | """Generate SHA256 hash for SRI (Subresource Integrity)""" |
| 16 | if isinstance(content, str): |
| 17 | content = content.encode("utf-8") |
| 18 | sha256_hash = hashlib.sha256(content).digest() |
| 19 | return "sha256-" + base64.b64encode(sha256_hash).decode("utf-8") |
| 20 | |
| 21 | |
| 22 | # Build script to set global PlotlyConfig object. This must execute before |