MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / replay_rtmr

Function replay_rtmr

sdk/python/src/dstack_sdk/dstack_client.py:32–43  ·  view source on GitHub ↗
(history: list[str])

Source from the content-addressed store, hash-verified

30
31
32def replay_rtmr(history: list[str]) -> str:
33 if len(history) == 0:
34 return INIT_MR
35 mr = bytes.fromhex(INIT_MR)
36 for content in history:
37 # mr = sha384(concat(mr, content))
38 # if content is shorter than 48 bytes, pad it with zeros
39 content_bytes = bytes.fromhex(content)
40 if len(content_bytes) < 48:
41 content_bytes = content_bytes.ljust(48, b"\0")
42 mr = hashlib.sha384(mr + content_bytes).digest()
43 return mr.hex()
44
45
46def get_endpoint(endpoint: str | None = None) -> str:

Callers 1

replay_rtmrsMethod · 0.70

Calls 1

digestMethod · 0.45

Tested by

no test coverage detected