1234567891011121314151617181920212223242526272829 |
- import hashlib
- import io
- from pathlib import Path
- def get_hash(filename):
- with open(filename, "r", encoding="latin-1") as frh:
- with open(filename + ".sha", "w", encoding="latin-1") as fwh:
- with io.StringIO() as chunk:
- for line in frh.readlines():
- fwh.write(sha256_digest(line) + "\n")
- def sha256_digest(chunk):
- m = hashlib.sha256(chunk.encode())
- return m.hexdigest()
- def check_folder(folder):
- for f in Path(folder).glob("*.csv"):
- get_hash(str(f))
- def main():
- check_folder("C:\\Users\\GAPS\\Documents\\SQL_Vergleich")
- if __name__ == "__main__":
- main()
|