Lesson 34: Monitoring File Changes

This script detects changes in a file by comparing hashes.

import hashlib

def get_hash(file):
  with open(file, "rb") as f:
    return hashlib.md5(f.read()).hexdigest()

hash1 = get_hash("data.txt")
print("File hash:", hash1)

Useful for detecting unauthorized file modifications.

Next Lesson →