def hex_string_to_int(hexstring, pos=0, length=4, shift=8):
    """
    Converts a hex string to an integer
    """
    total = 0
    shift_multiplier = length
    for i in range(pos, pos + length):
        shift_multiplier -= 1
        total += ord(hexstring[i]) << shift * shift_multiplier
    return total
