def calchash(data, key):
    """Calculate file name hash.
    
    Args:
        data: File name data.
        key: Hash key.
    
    Returns:
        Hash value.
    """
    ret = 0
    for c in data:
        ret = (ret * key + ord(c)) & 0xffffffff
    return ret