def synthesize_nonce(s, key, timestamp=None):
    """Synthesize a nonce value.

    A nonce value resists spoofing and can be checked
    for staleness. Returns a string suitable as the value for 'nonce' in
    the www-authenticate header.

    s
        A string related to the resource, such as the hostname of the server.

    key
        A secret string known only to the server.

    timestamp
        An integer seconds-since-the-epoch timestamp

    """
    if timestamp is None:
        timestamp = int(time.time())
    h = md5_hex('%s:%s:%s' % (timestamp, s, key))
    nonce = '%s:%s' % (timestamp, h)
    return nonce
Synthesize a nonce value.

    A nonce value resists spoofing and can be checked
    for staleness. Returns a string suitable as the value for 'nonce' in
    the www-authenticate header.

    s
        A string related to the resource, such as the hostname of the server.

    key
        A secret string known only to the server.

    timestamp
        An integer seconds-since-the-epoch timestamp

    
cherrypy/lib/auth_digest.py