Files
mtusi2026lab4/app/object_locks.py
T

13 lines
298 B
Python

from __future__ import annotations
import hashlib
def object_lock_id(bucket: str, object_key: str) -> int:
value = f"s3-object\0{bucket}\0{object_key}".encode("utf-8")
return int.from_bytes(
hashlib.sha256(value).digest()[:8],
byteorder="big",
signed=True,
)