def test_retrieve(self): for key in self.keys: points = crypto.split_key(key, n=5, k=5) reconstruction = crypto.retrieve_key(points) self.assertEqual(key, reconstruction) points = crypto.split_key(key, n=5, k=3) reconstruction = crypto.retrieve_key(points[:3]) self.assertEqual(key, reconstruction) points = crypto.split_key(key, n=5, k=1) reconstruction = crypto.retrieve_key(points[:1]) self.assertEqual(key, reconstruction)
def test_random_keys(self): for _ in range(100): key = self.generate_key() points = crypto.split_key(key, n=5, k=3) reconstruction = crypto.retrieve_key(points[:3]) self.assertEqual(key, reconstruction)