import ctypes


def hash_djb2(string):
    """hash a string using djb2 with seed 5381
    Args:
        string (str): string to hash
    Returns:
        (int): hashval of string masked to force positive by masking 32-bit
    """
    hashval = ctypes.c_uint(5381)
    for char in string:
        hashval.value = ((hashval.value << 5) + hashval.value) + ord(char)
    return hashval.value & 0x7FFFFFFF