]> Cypherpunks.ru repositories - pyssss.git/blob - test_ssss.py
Raise copyright years
[pyssss.git] / test_ssss.py
1 # coding: utf-8
2
3 from os import urandom
4 from random import randint
5 from unittest import TestCase
6
7 import ssss
8
9
10 class TestSSSS(TestCase):
11     def test_symmetric(self):
12         for _ in range(10):
13             n = randint(3, 100)
14             r = randint(1, n)
15             secret = urandom(32)
16             frags = ssss.split(secret, n, r)
17             recovered = ssss.combine(r, frags[:r])
18             self.assertEqual(secret, recovered)