首页 > 解决方案 > Python blocksize 大小混乱

问题描述

我是 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()

标签: python

解决方案


推荐阅读