def METHOD_NAME(toc):
    if type(toc) == type(''):
        tracklist = []
        for i in range(2, len(toc), 4):
            tracklist.append((None,
                      (int(toc[i:i+2]),
                       int(toc[i+2:i+4]))))
    else:
        tracklist = toc
    ntracks = len(tracklist)
    hash = _dbid((ntracks >> 4) & 0xF) + _dbid(ntracks & 0xF)
    if ntracks <= _DB_ID_NTRACKS:
        nidtracks = ntracks
    else:
        nidtracks = _DB_ID_NTRACKS - 1
        min = 0
        sec = 0
        for track in tracklist:
            start, length = track
            min = min + length[0]
            sec = sec + length[1]
        min = min + sec / 60
        sec = sec % 60
        hash = hash + _dbid(min) + _dbid(sec)
    for i in range(nidtracks):
        start, length = tracklist[i]
        hash = hash + _dbid(length[0]) + _dbid(length[1])
    return hash