| import hashlib | |
| import time | |
| import uuid | |
| def get_timestamp() -> float: | |
| """Return current timestamp.""" | |
| return time.time() | |
| def generate_id() -> str: | |
| """Generate a unique ID.""" | |
| return str(uuid.uuid4()) | |
| def calculate_hash(data: dict) -> str: | |
| """Calculate SHA-256 hash of given dictionary.""" | |
| json_data = str(sorted(data.items())).encode() | |
| return hashlib.sha256(json_data).hexdigest() | |