Changed hash algo to sha256

This commit is contained in:
Alex Davies 2024-12-20 11:02:23 -04:00
parent b5a832169b
commit 4792a64ac9
3 changed files with 8 additions and 3 deletions

View File

@ -1,5 +1,6 @@
Generates system reports for ensuring robots are compliant with specs
![](./docs/Screenshot_20241220_105946.png)
```bash
#Generate a known-good config

View File

@ -122,7 +122,8 @@ def info(compare_to: Path = None):
hash_table = table.Table(title="System Hash", show_header=False, box=None)
for key, value in data.items():
hash_value = hashlib.md5(str(value).encode()).hexdigest()
#Hash with a reasonable algorithm
hash_value = hashlib.sha256(str(value).encode()).hexdigest()
if compare_to:
if key in old_data:
if old_data[key] == value:
@ -135,7 +136,7 @@ def info(compare_to: Path = None):
hash_table.add_row(key, hash_value)
hashes[key] = hash_value
system_hash = hashlib.md5(str(data).encode()).hexdigest()
system_hash = hashlib.sha256(str(data).encode()).hexdigest()
hashes["system"] = system_hash
hash_table.add_row("System", system_hash)
@ -156,7 +157,7 @@ def save(output: Path):
"""
data = info()
with open(output, "w") as f:
json.dump(data, f)
json.dump(data, f, indent=2)
def main_cli():
app()

BIN
docs/Screenshot_20241220_105946.png (Stored with Git LFS) Normal file

Binary file not shown.