def test_div_gf2(self):
        from Cryptodome.Util.number import size as deg

        x, y = _div_gf2(567, 7)
        self.failUnless(deg(y) < deg(7))

        w = _mult_gf2(x, 7) ^ y
        self.assertEqual(567, w)

        x, y = _div_gf2(7, 567)
        self.assertEqual(x, 0)
        self.assertEqual(y, 7)
Exemplo n.º 2
0
    def test_div_gf2(self):
        from Cryptodome.Util.number import size as deg

        x, y = _div_gf2(567, 7)
        self.assertTrue(deg(y) < deg(7))

        w = _mult_gf2(x, 7) ^ y
        self.assertEqual(567, w)

        x, y = _div_gf2(7, 567)
        self.assertEqual(x, 0)
        self.assertEqual(y, 7)