def filehash(filename): f = open(filename, "rb") print("opened") sum = hasher() for block in FileIter(f): sum.update(block) return sum.hexdigest()
def _makehash(self, *values): hash = hasher() for value in values: hash.update(value) return hash
def testUseHasher(self): 'Test accessing hasher as imported.' expected = eval('hashlib.' + self.saved_algorithm.strip() + '()') actual = sethash.hasher() self.assertIsInstance(actual, type(expected))