Calculate the digest of a file.
(alg, filen)
| 1712 | |
| 1713 | |
| 1714 | def algsum(alg, filen): |
| 1715 | '''Calculate the digest of a file. |
| 1716 | ''' |
| 1717 | with open(filen, 'rb') as fileh: |
| 1718 | digest = getattr(hashlib, alg)(fileh.read()) |
| 1719 | |
| 1720 | return digest.hexdigest() |