Zaimplementować funkcję liczącą skrót (fingerprint) o sygnaturze:
get_hash(files_to_hash)
gdzie
files_to_hash to struktura (lista Python-a) postaci:
[
{"path": <path to file 1>, "include": <boolean value whether include file or only its hash>},
...
{"path": <path to file N>, "include": <boolean value whether include file or only its hash>}
]
Przykład
files_to_hash dla
N=2:
[
{"path": "path/to/some/small_file.txt", "include": True},
{"path": "path/to/some/very_large_file.bin", "include": False}
]
Na podstawie
files_to_hash program konstruuje pośrednią strukturę
data_to_hash postaci:
[
{"path": "path/to/some/small_file.txt", "data": <Base 64 encoded file>},
{"path": "path/to/some/very_large_file.bin", "hash": <Hash of file>}
]
Funkcja powinna zwrócić słownik postaci:
{
"files": <files_to_hash>,
"hash": <hash calculated for data_to_hash>
}
gdzie
<hash calculated for data_to_hash> jest hashem policzonym dla pośredniej struktury
data_to_hash.