หา hash ของไฟล์ด้วยไลบรารี hashlib ขนาดไฟล์อาจใหญ่ ควรใช้ buffer โหลดทีละชิ้นและประมวลผลคำนวณ hash ขนาด buffer ใดก็ได้ ตัวอย่าง import sys import hashlib BUF_SIZE = 32768 # อ่านไฟล์ทีละ 32kb md5 = hashlib.md5() sha1 = hashlib.sha1() with open(program.cpp, rb) as f: while True: data = f.