def test_roundtrip_unpadded(self): secret = str(os.urandom(1024)) (shares, threshold) = self.rand_shares(secret, 8) recovered = PySSSS.recoversecret(random.sample(shares, threshold)) self.assertEqual(recovered, secret)
def test_not_enough_shares(self): secret = str(os.urandom(100)) (shares, threshold) = self.rand_shares(secret, 8) with self.assertRaises(ValueError): PySSSS.recoversecret(random.sample(shares, threshold-1))
def test_recoversecret(self): self.assertEqual(PySSSS.recoversecret(_goodsplit), _secret) self.assertNotEqual(PySSSS.recoversecret(_badsplit), _secret)