[issue17436] hashlib: add a method to hash the content of a file

2016-04-02 Thread Aviv Palivoda
Aviv Palivoda added the comment: > * hashobj.readfile(filename: str) > * hashobj.readfileobj(file) where file is an object with a read() method > which returns bytes strings I changed the API to the one Victor suggested. > For readfile() it might make more sense to implement it directly in C a

[issue17436] hashlib: add a method to hash the content of a file

2016-04-01 Thread Christian Heimes
Christian Heimes added the comment: For readfile() it might make more sense to implement it directly in C and let OpenSSL's BIO layer handle IO internally. It's more efficient and you can release the GIL around the whole operation. -- nosy: +christian.heimes __

[issue17436] hashlib: add a method to hash the content of a file

2016-04-01 Thread STINNER Victor
STINNER Victor added the comment: > I added a new method to the hash object named fromfile(). Usually, fromxxx() is used to create a new object. In your case, it's more to update an existing hash object. So I would prefer the name "readfile". IMHO you need two methods: * hashobj.readfile(file

[issue17436] hashlib: add a method to hash the content of a file

2016-04-01 Thread Aviv Palivoda
Aviv Palivoda added the comment: While working on issue 26488 I found a real need for this feature. I added a new method to the hash object named fromfile(). The function update the hash object with the content of the file like object it receives. I only added the feature to hash algorithm prov

[issue17436] hashlib: add a method to hash the content of a file

2013-03-18 Thread STINNER Victor
Changes by STINNER Victor : -- title: pass a file object to hashlib.update -> hashlib: add a method to hash the content of a file versions: +Python 3.4 -Python 3.5 ___ Python tracker __