ho trovato (ma non provato) la funzione

hexdec

che converte una stringa esadecimale in numero

quando hai i numeri poi puoi fare l'or