directoryhash是python的库。它提供了获取目标文件夹散列的机会。您可以选择将参与计算的文件类型。
directoryhash的Python项目详细描述
directoryhash是python的库。它提供了获取目标文件夹散列的机会。您可以选择将参与计算的文件类型。
安装
使用pip安装:
pip install directoryhash
…或从github克隆项目:
https://github.com/san4ezy/directoryhash.git
如何使用?
正在获取整个目录的哈希:
from directoryhash import md5, sha1 md5_hash = md5("path_to_directory") sha1_hash = sha1("path_to_directory")
正在获取仅包含HTML和CSS的目录的哈希:
from directoryhash import md5, sha1 filetypes = ('.html', '.css',) md5_hash = md5("path_to_directory", filetypes) sha1_hash = sha1("path_to_directory", filetypes)
捕捉异常:
from directoryhash import md5, HashedDirectoryDoesNotExist directory_path = "path_to_destination_folder" try: md5(directory_path) except HashedDirectoryDoesNotExist as e: print(e)