示例#1
0
 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)
示例#2
0
 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))
示例#3
0
 def test_recoversecret(self):
     self.assertEqual(PySSSS.recoversecret(_goodsplit), _secret)
     self.assertNotEqual(PySSSS.recoversecret(_badsplit), _secret)