def test_twoparts(self): data = HashedPRNG(b"foobar").get(256) for l in range(len(data) + 1): prng = HashedPRNG(b"foobar") part1 = prng.get(l) part2 = prng.get(len(data) - l) self.assertEqual(data, part1 + part2)
def _prepare_file(fp, data): fp.truncate(0) fp.seek(0) prng = HashedPRNG(seed=b"woohoo") for element in data: if isinstance(element, int): fp.write(prng.get(element)) else: fp.write(element) fp.flush()
def test_prng(self): prng = HashedPRNG(b"foobar") first = prng.get(128) prng.reset() second = prng.get(128) self.assertEqual(first, second)