def pbkdf2(password, salt, iterations, dklen=0, digest=None):
    assert iterations > 0
    if not digest:
        digest = hashlib.sha256
    hlen = digest().digest_size
    if not dklen:
        dklen = hlen
    if dklen > (2 ** 32 - 1) * hlen:
        raise OverflowError('dklen too big')
    l = -(-dklen // hlen)
    r = dklen - (l - 1) * hlen

    hex_format_string = "%%0%ix" % (hlen * 2)

    def F(i):
        def U():
            u = salt + struct.pack('>I', i)
            for j in xrange(int(iterations)):
                u = _fast_hmac(password, u, digest).digest()
                yield _bin_to_long(u)
        return _long_to_bin(reduce(operator.xor, U()), hex_format_string)

    T = [F(x) for x in range(1, l + 1)]
    return ''.join(T[:-1]) + T[-1][:r]
event_name := {'created', 'modified', 'deleted'}, list, tuple
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/django/utils/crypto.py/pbkdf2--crossover with--dataset/ETHPy150Open jeffh/sniffer/sniffer/scanner/base.py/BaseScanner.observe