Homeassistant template with XOR

Hello,

For a specific script I need to be able to send a computed value in MQTT, based on a xor operation:

...
    sequence:
        - service: mqtt.publish
          data:
              topic: "sensor"
              payload_template: "12345678{{ '%X' % V1 }}0{{ '%X' % V2 }}000{{ '%X' % (V1 ^ V2) }}"
...

The last byte is a kind of checksum based on a XOR operation. The problem is that this XOR operation does not exist in homeassistant. There are some pull request providing this operation to homeassistant (bitwise_xor), but it is not taken into account by developpers.

Do you have any workaround to perform such an operation ? I bet that my only choice will be to use a custom component, to add this basic feature. However, I have no idea how to add some jinja2 filter to homeassistant.

Thank you in advance