Hashing file in Python 3?

前端 未结 3 1146
慢半拍i
慢半拍i 2021-01-18 14:08

In Python 2, one could hash a string by just running:

someText = \"a\"
hashlib.sha256(someText).hexdigest()

But in Python 3, it needs to be

3条回答
  •  长情又很酷
    2021-01-18 14:17

    I have programmed a module which is able to hash big files with different algorithms.

    pip3 install py_essentials
    

    Use the module like this:

    from py_essentials import hashing as hs
    hash = hs.fileChecksum("path/to/the/file.txt", "sha256")
    

    Take a look at the documentation.

提交回复
热议问题