[pycrypto] Inovking Depreciation warnings in Python

Oz Nahum Tiram nahumoz at gmail.com
Thu Dec 13 01:16:10 PST 2012


Hi Dwayne,

First, thanks for the answer and sorry for the late reply.

So, I replace the following code with your example:

    # in the past:
    >>> from Crypto.Util.randpool import RandomPool
    >>> random = RandomPool()
    >>> key = str(random.get_bytes(32)).encode('base64')

    # current:
    from Crypto.Random import get_random_bytes
    key = str(get_random_bytes(32).encode('base64'))

Is this correct? If so, that is sweet, an one line shorter!

Thanks,

Oz


More information about the pycrypto mailing list