def gf_mul(multiplicand, multiplier):
    """
    Galois Field multiplication function for AES using irreducible polynomial
    x^8 + x^4 + x^3 + x^1 + 1
    """
    product = 0
    a = multiplicand
    b = multiplier
    while a * b > 0:
        if b % 2:
            product ^= a
        if a >= 128:
            a = (a << 1) ^ 283
        else:
            a <<= 1
        b >>= 1
    return product