mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-18 12:09:12 +00:00
Add checksum verification for portable backups
This commit is contained in:
@@ -1,9 +1,18 @@
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from utils import checksum
|
||||
|
||||
|
||||
def test_json_checksum():
|
||||
data = {"b": 1, "a": 2}
|
||||
expected = hashlib.sha256(
|
||||
json.dumps(data, sort_keys=True, separators=(",", ":")).encode()
|
||||
).hexdigest()
|
||||
assert checksum.json_checksum(data) == expected
|
||||
|
||||
|
||||
def test_calculate_checksum(tmp_path):
|
||||
file = tmp_path / "data.txt"
|
||||
content = "hello world"
|
||||
|
Reference in New Issue
Block a user