Skip to content

Commit

Permalink
randomness test
Browse files Browse the repository at this point in the history
  • Loading branch information
heronhaye committed Dec 3, 2018
1 parent 8b81e46 commit 6e5555d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions triplesec/test/test.py
Expand Up @@ -118,6 +118,19 @@ def test_random_encryption(self):
c = triplesec.encrypt(p, k)
self.assertEqual(p, triplesec.decrypt(c, k), i)

def test_using_randomness(self):
for version in _versions.keys():
compatibility = version in {1, 3}
T = TripleSec(key=b"YELLOW_SUBMARINE")
pt = b"foobar"
once = T.encrypt(pt, v=version, compatibility=compatibility)
twice = T.encrypt(pt, v=version, compatibility=compatibility)
self.assertNotEqual(once, twice)
T = TripleSec(key=b"YELLOW_SUBMARINE")
thrice = T.encrypt(pt, v=version, compatibility=compatibility)
self.assertNotEqual(once, thrice)
self.assertNotEqual(twice, thrice)

def test_external_vectors(self):
for V in vectors:
if 'disabled' in V: continue
Expand Down

0 comments on commit 6e5555d

Please sign in to comment.