mitsuhiko/flask — pull request #1223 by Hasimir (2014-10-26 20:17:02+00:00)
Title: Improved secret key generation example

Improved secret key generation by randomising seed and adding SHA-2 (SHA256) hash digest of it. Added b64 and hexdigest variants.

Should probably use random.SystemRandom(Random) instead of os.random(), but this is supposed to be a quickstart and code should have a fallback to os.random f random.SystemRandom is not available.

Uses random, hashlib, os and (optionally) base64 standard modules instead of just os.