def check(self, data, digest): computed = rsha.new(data).hexdigest() assert computed == digest d = rsha.sha() d.update(data) computed = d.digest() assert computed == digest.decode('hex')
def test_copy(self): import sha for repeat in [1, 10, 100]: d1 = rsha.sha("abc" * repeat) d2 = d1.copy() d1.update("def" * repeat) d2.update("gh" * repeat) assert d1.digest() == sha.sha("abc"*repeat+"def"*repeat).digest() assert d2.digest() == sha.sha("abc"*repeat+"gh"*repeat).digest()