我是python编程的新手,因此在本节中我感到困惑。当我在代码中分配块大小时,例如 blocksize = 512 ,它以字节为单位吗?
BLOCKSIZE = 65536
start_time = process_time()
hasher = hashlib.sha512()
with open(file_dir+file_name, 'rb') as hashfile:
buf = hashfile.read(BLOCKSIZE)
while len(buf) > 0:
hasher.update(buf)
buf = hashfile.read(BLOCKSIZE)
hashfile.close()