algorithms.c: Add a Keccak `set' method now there's upstream support.
[catacomb-python] / t / t-algorithms.py
index 593e6cf..455e947 100644 (file)
@@ -746,11 +746,11 @@ class TestKeccak (HashBufferTestMixin):
     st1.mix(m0).step()
     me.assertNotEqual(st0.extract(32), st1.extract(32))
 
-    ## Check state copying.
+    ## Check state copying and `mix' vs `set'.
     st1 = st0.copy()
     mask = st1.extract(len(m1))
     st0.mix(m1)
-    st1.mix(m1)
+    st1.set(m1 ^ mask)
     me.assertEqual(st0.extract(32), st1.extract(32))
 
     ## Check error conditions.
@@ -758,6 +758,9 @@ class TestKeccak (HashBufferTestMixin):
     me.assertRaises(ValueError, st0.extract, 201)
     st0.mix(T.span(200))
     me.assertRaises(ValueError, st0.mix, T.span(201))
+    st0.set(T.span(200))
+    me.assertRaises(ValueError, st0.set, T.span(201))
+    me.assertRaises(ValueError, st0.set, T.span(199))
 
   def check_shake(me, xcls, c, done_matches_xof = True):
     """