def sdbm(s):
    """Generic purpose string hash function (see http://www.cse.yorku.ca/~oz/hash.html)"""
    h = 0
    for c in s:
        h = ord(c) + (h << 6) + (h << 16) - h
        h &= 18446744073709551615
    return h
