MCPcopy Index your code
hub / github.com/plotly/plotly.py / _generate_sri_hash

Function _generate_sri_hash

plotly/io/_html.py:14–19  ·  view source on GitHub ↗

Generate SHA256 hash for SRI (Subresource Integrity)

(content)

Source from the content-addressed store, hash-verified

12
13
14def _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

Callers 4

test_offline.pyFile · 0.90
test_repr_htmlFunction · 0.90
to_htmlFunction · 0.85

Calls 2

encodeMethod · 0.45
decodeMethod · 0.45

Tested by 2

test_repr_htmlFunction · 0.72