helpers.py 文件源码

python
阅读 50 收藏 0 点赞 0 评论 0

项目:jak 作者: dispel 项目源码 文件源码
def generate_256bit_key():
    """Generate a pseudo-random secure ready-for-crypto-use key.

    Generate it straight using urandom. Proving randomness is impossible, and a good source
    is a hotly debated subject. As always, opinions are welcome but please inform
    yourself first and be prepared to cite a source.

    Further Reading:
    https://docs.python.org/3.5/library/os.html#os.urandom
    https://docs.python.org/2.7/library/os.html#os.urandom
    https://sockpuppet.org/blog/2014/02/25/safely-generate-random-numbers/
    http://www.2uo.de/myths-about-urandom/
    https://github.com/dlitz/pycrypto/blob/master/lib/Crypto/Random/__init__.py
    """
    return binascii.hexlify(os.urandom(32))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号