common.dh: Reformat to follow PEP-0008.

This commit is contained in:
Emmanuel Gil Peyrot 2017-02-07 19:56:52 +00:00
parent 289d82fae7
commit 5f91455fb9
1 changed files with 195 additions and 192 deletions

View File

@ -28,7 +28,8 @@ These constants have been obtained from RFC2409 and RFC3526.
import string import string
generators = [None, # one to get the right offset generators = [
None, # one to get the right offset
2, 2,
2, 2,
None, None,
@ -46,9 +47,11 @@ generators = [None, # one to get the right offset
2, 2,
2, 2,
2, 2,
2] 2
]
hex_primes = [None, _HEX_PRIMES = [
None,
# group 1 # group 1
'''FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 '''FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1
@ -218,13 +221,13 @@ B1D510BD 7EE74D73 FAF36BC3 1ECFA268 359046F4 EB879F92
60C980DD 98EDD3DF FFFFFFFF FFFFFFFF''' 60C980DD 98EDD3DF FFFFFFFF FFFFFFFF'''
] ]
all_ascii = ''.join(map(chr, range(256))) _ALL_ASCII = ''.join(map(chr, range(256)))
def hex_to_decimal(stripee): def hex_to_decimal(stripee):
if not stripee: if not stripee:
return None return None
return int(stripee.translate(all_ascii).translate(str.maketrans("", "", return int(stripee.translate(_ALL_ASCII).translate(
string.whitespace)), 16) str.maketrans("", "", string.whitespace)), 16)
primes = list(map(hex_to_decimal, hex_primes)) primes = list(map(hex_to_decimal, _HEX_PRIMES))