This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: RF: ``pathlib.Path.checksum()`` member
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.8, Python 3.7
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: oesteban, pitrou
Priority: normal Keywords:

Created on 2019-01-18 23:29 by oesteban, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (2)
msg334023 - (view) Author: Oscar Esteban (oesteban) * Date: 2019-01-18 23:29
Gauging the interest in a checksum calculation function built-in Path objects:

```
>>> Path('somefile.img').checksum()
'4976c36bacf922cbc5c811c9c288e61d'

>>> Path('somefile.img').checksum(hash='md5')
'4976c36bacf922cbc5c811c9c288e61d'

>>> Path('somefile.img').checksum(hash='sha256')
'12917abe21e1eb4ba3c704600db53a1ff1434b3259422b86bfd08afa8216e4aa'

>>> Path.home().checksum()
'798d3a5c2b679750a90e91b09cf93129'

>>> Path.home().checksum(hash='sha256')
'b3e04961fd54818d93aac305db4a3dec51b9731808c19ea9c59460c841e2d145'

# Do not checksum content, just the file's path, as for directories
>>> Path('somefile.img').checksum(content=False)
'3fb531e352cbc2e2103ab73ede40f2d6'
```
msg334063 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2019-01-19 12:22
Sorry, but it does not make sense to me (not would it make sense to add e.g. a JPEG decoder to pathlib).  Each project or application would want their own checksumming specification and pathlib does not have to cater to that.
History
Date User Action Args
2022-04-11 14:59:10adminsetgithub: 79959
2019-01-19 12:22:48pitrousetstatus: open -> closed
resolution: rejected
messages: + msg334063

stage: resolved
2019-01-19 02:32:25xtreaksetnosy: + pitrou
2019-01-18 23:29:15oestebancreate