def test_different(self): self.assertFalse(ct_compare_digest(bytearray(b'\x01'), bytearray(b'\x03'))) self.assertFalse(ct_compare_digest(bytearray(b'\x01'*10 + b'\x02'), bytearray(b'\x01'*10 + b'\x03'))) self.assertFalse(ct_compare_digest(bytearray(b'\x02' + b'\x01'*10), bytearray(b'\x03' + b'\x01'*10)))
def test_different_lengths(self): self.assertFalse(ct_compare_digest(bytearray(10), bytearray(12))) self.assertFalse(ct_compare_digest(bytearray(20), bytearray(12)))
def test_with_equal_length(self): self.assertTrue(ct_compare_digest(bytearray(10), bytearray(10))) self.assertTrue(ct_compare_digest(bytearray(b'\x02'*8), bytearray(b'\x02'*8)))