Mageia Bugzilla – Attachment 8841 Details for
Bug 20031
python-pycrypto new security issue CVE-2013-7459
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
Random output test for python[3]-pycrypto
cryptoRandom.py (text/plain), 821 bytes, created by
Lewis Smith
on 2017-01-08 15:00:23 CET
(
hide
)
Description:
Random output test for python[3]-pycrypto
Filename:
MIME Type:
Creator:
Lewis Smith
Created:
2017-01-08 15:00:23 CET
Size:
821 bytes
patch
obsolete
>from binascii import hexlify >import multiprocessing, pprint, time >import Crypto.Random > >def task_main(arg): > a = Crypto.Random.get_random_bytes(8) > time.sleep(0.1) > b = Crypto.Random.get_random_bytes(8) > rdy, ack = arg > rdy.set() > ack.wait() > return "%s,%s" % (hexlify(a).decode(), > hexlify(b).decode()) > >n_procs = 4 >manager = multiprocessing.Manager() >rdys = [manager.Event() for i in range(n_procs)] >acks = [manager.Event() for i in range(n_procs)] >Crypto.Random.get_random_bytes(1) >pool = multiprocessing.Pool(processes=n_procs, > initializer=Crypto.Random.atfork) >res_async = pool.map_async(task_main, zip(rdys, acks)) >pool.close() >[rdy.wait() for rdy in rdys] >[ack.set() for ack in acks] >res = res_async.get() >pprint.pprint(sorted(res)) >pool.join() >
from binascii import hexlify import multiprocessing, pprint, time import Crypto.Random def task_main(arg): a = Crypto.Random.get_random_bytes(8) time.sleep(0.1) b = Crypto.Random.get_random_bytes(8) rdy, ack = arg rdy.set() ack.wait() return "%s,%s" % (hexlify(a).decode(), hexlify(b).decode()) n_procs = 4 manager = multiprocessing.Manager() rdys = [manager.Event() for i in range(n_procs)] acks = [manager.Event() for i in range(n_procs)] Crypto.Random.get_random_bytes(1) pool = multiprocessing.Pool(processes=n_procs, initializer=Crypto.Random.atfork) res_async = pool.map_async(task_main, zip(rdys, acks)) pool.close() [rdy.wait() for rdy in rdys] [ack.set() for ack in acks] res = res_async.get() pprint.pprint(sorted(res)) pool.join()
View Attachment As Raw
Actions:
View
Attachments on
bug 20031
: 8841 |
8842