Opened 4 years ago

Closed 4 years ago

#6061 enhancement closed fixed (fixed)

Port twisted.python.randbytes to Python 3

Reported by: Jean-Paul Calderone Owned by: Jean-Paul Calderone
Priority: normal Milestone: Python 3.3 Minimal
Component: core Keywords:
Cc: Branch: branches/randbytes-py3-6061
branch-diff, diff-cov, branch-cov, buildbot
Author: exarkun

Description

This is needed by twisted.names.dns.

Change History (8)

comment:1 Changed 4 years ago by Jean-Paul Calderone

Author: exarkun
Branch: branches/randbytes-py3-6061

(In [35956]) Branching to 'randbytes-py3-6061'

comment:2 Changed 4 years ago by Jean-Paul Calderone

Keywords: review added
Owner: changed from Jean-Paul Calderone to Itamar Turner-Trauring

Okay, worse than I thought, and the module is somewhat useless now that its alternative-selection features have been deleted. Oh well, I did it anyway, and I wish it had been easier and more useful. Build started: http://buildbot.twistedmatrix.com/boxes-supported?branch=/branches/randbytes-py3-6061

comment:3 Changed 4 years ago by Itamar Turner-Trauring

I was actually going to suggest (in a new ticket) the use of randrange elsewhere in twisted.names.dns be switched to something secure based on inputs from os.urandom. Probably randbytes would be a reasonable place to add that sort of thing, so might be worth keeping around.

comment:4 Changed 4 years ago by Jean-Paul Calderone

What do you mean "switched to something secure"? That's the point of twisted.python.randbytes.secureRandom, which is what twisted.names.dns currently uses.

comment:5 Changed 4 years ago by Itamar Turner-Trauring

DNSMixin.__init__ uses randrange; not sure if that id has any meaning or use though.

comment:6 Changed 4 years ago by Jean-Paul Calderone

Ah. Good catch! That id looks unused to me. Perhaps I'll delete it.

comment:7 Changed 4 years ago by Itamar Turner-Trauring

Keywords: review removed
Owner: changed from Itamar Turner-Trauring to Jean-Paul Calderone

Looks good, please merge.

(We should keep our eye out and see if we want to make a twisted.python.compat.bytechr if this comes up again.)

comment:8 Changed 4 years ago by Jean-Paul Calderone

Resolution: fixed
Status: newclosed

(In [35963]) Merge randbytes-py3-6061

Author: exarkun Reviewer: itamarst Fixes: #6061

Port twisted.python.randbytes to Python 3.

Note: See TracTickets for help on using tickets.