MCPcopy Create free account
hub / github.com/TheSecuredAnalyst/security-suite / _compute_checksum

Method _compute_checksum

core/cache.py:54–75  ·  view source on GitHub ↗

Compute checksum for cache key. Args: target: Target string modules: Modules to run options: Module options Returns: Hex checksum string

(
        target: str,
        modules: list[str],
        options: dict[str, Any] = None,
    )

Source from the content-addressed store, hash-verified

52 self._memory_cache: dict[str, CacheEntry] = {}
53 logger.info(f"Initialized scan cache with TTL={ttl_seconds}s at {self.cache_dir}")
54
55 @staticmethod
56 def _compute_checksum(
57 target: str,
58 modules: list[str],
59 options: dict[str, Any] = None,
60 ) -> str:
61 """Compute checksum for cache key.
62
63 Args:
64 target: Target string
65 modules: Modules to run
66 options: Module options
67
68 Returns:
69 Hex checksum string
70 """
71 key_data = {
72 "target": target,
73 "modules": sorted(modules),
74 "options": options or {},
75 }
76 key_str = json.dumps(key_data, sort_keys=True)
77 return hashlib.sha256(key_str.encode()).hexdigest()
78

Callers 3

getMethod · 0.95
setMethod · 0.95

Calls

no outgoing calls

Tested by 1