def share_and_recover(num_players, reconstruction_threshold, secret, end): max_secret_length = len(secret) players = test_authenticated_rss.get_ids(num_players) robust_shares = rss.share_authenticated_secret(players, reconstruction_threshold, max_secret_length, secret) shares = {player: share for (player, share) in robust_shares.items()[:end]} return rss.reconstruct_unauthenticated_secret(num_players, max_secret_length, shares)
def test_min_shares_some_bad(): num_players = 9 reconstruction_threshold = 5 num_bad = 2 max_secret_length = len(secret) players = test_authenticated_rss.get_ids(num_players) robust_shares = rss.share_authenticated_secret(players, reconstruction_threshold, max_secret_length, secret) result = corrupt_and_recover(robust_shares, num_players, num_players, num_bad) assert result is None or result != secret