authomatic/providers/__init__.py
def csrf_generator(secret):
        """
        Generates CSRF token.

        Inspired by this article:
        http://blog.ptsecurity.com/2012/10/random-number-security-in-python.html

        :returns:
            :class:`str` Random unguessable string.

        """

        # Create hash from random string plus salt.
        hashed = hashlib.md5(uuid.uuid4().bytes + six.b(secret)).hexdigest()

        # Each time return random portion of the hash.
        span = 5
        shift = random.randint(0, span)
        return hashed[shift:shift - span - 1]
def csrf_generator(secret):
        # Create hash from random string plus salt.
        hashed = hashlib.md5(uuid.uuid4().bytes + six.b(secret)).hexdigest()

        # Each time return random portion of the hash.
        span = 5
        shift = random.randint(0, span)
        return hashed[shift:shift - span - 1]
def csrf_generator ( secret ) : # Create hash from random string plus salt. hashed = hashlib . md5 ( uuid . uuid4 ( ) . bytes + six . b ( secret ) ) . hexdigest ( ) # Each time return random portion of the hash. span = 5 shift = random . randint ( 0 , span ) return hashed [ shift : shift - span - 1 ]
Generates CSRF token.

        Inspired by this article:
        http://blog.ptsecurity.com/2012/10/random-number-security-in-python.html

        :returns:
            :class:`str` Random unguessable string.
Generates CSRF token .