def multiGF8( input1, input2, modP8):
    """
    multiGF8 - multiply 2 number on a Galois Field defined by a polynomial.
    Args:
        input1: first number to multiply.
        input2: second number to multiply.
        modP8: polynomial defining the Galos Field.
    Returns:
        the multiplication result.
    """
    state1 = 0x0
    for i in range(8):
        #print( 'i: {:2x}, input1: {:4x}, input2: {:4x}, state1: {:4x}'
        #       ''.format(i,input1,input2,state1))
        if input2&0x1:
            state1 ^= input1
        input2 >>= 1
        input1 <<= 1
        if input1&0x100:
            input1 ^= modP8
    return state1