Example #1
0
 def rand_shares(self, secret, maxshares):
     numshares = random.randrange(3, maxshares)
     threshold = random.randrange(2, numshares)
     shares = PySSSS.splitsecret(secret, threshold, numshares)
     return (shares, threshold)
Example #2
0
 def test_bad_threshold(self):
     with self.assertRaises(ValueError):
         PySSSS.splitsecret(_secret, _numshares, _threshold)
Example #3
0
 def test_not_a_share(self):
     with self.assertRaises(ValueError):
         PySSSS.splitsecret(_secret, 1, 1)
Example #4
0
 def test_splitsecret(self, RangeMock):
     RangeMock.side_effect = self.seq_random
     shares = PySSSS.splitsecret(_secret, _threshold, _numshares)
     self.assertEqual(shares, _goodsplit)
     self.assertNotEqual(shares, _badsplit)