diff options
author | shmel1k <shmel1k@ydb.tech> | 2023-11-26 18:16:14 +0300 |
---|---|---|
committer | shmel1k <shmel1k@ydb.tech> | 2023-11-26 18:43:30 +0300 |
commit | b8cf9e88f4c5c64d9406af533d8948deb050d695 (patch) | |
tree | 218eb61fb3c3b96ec08b4d8cdfef383104a87d63 /contrib/python/Twisted/py3/twisted/conch/openssh_compat/primes.py | |
parent | 523f645a83a0ec97a0332dbc3863bb354c92a328 (diff) | |
download | ydb-b8cf9e88f4c5c64d9406af533d8948deb050d695.tar.gz |
add kikimr_configure
Diffstat (limited to 'contrib/python/Twisted/py3/twisted/conch/openssh_compat/primes.py')
-rw-r--r-- | contrib/python/Twisted/py3/twisted/conch/openssh_compat/primes.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/contrib/python/Twisted/py3/twisted/conch/openssh_compat/primes.py b/contrib/python/Twisted/py3/twisted/conch/openssh_compat/primes.py new file mode 100644 index 0000000000..9e2070e19a --- /dev/null +++ b/contrib/python/Twisted/py3/twisted/conch/openssh_compat/primes.py @@ -0,0 +1,31 @@ +# Copyright (c) Twisted Matrix Laboratories. +# See LICENSE for details. + +# + +""" +Parsing for the moduli file, which contains Diffie-Hellman prime groups. + +Maintainer: Paul Swartz +""" + + +from typing import Dict, List, Tuple + + +def parseModuliFile(filename: str) -> Dict[int, List[Tuple[int, int]]]: + with open(filename) as f: + lines = f.readlines() + primes: Dict[int, List[Tuple[int, int]]] = {} + for l in lines: + l = l.strip() + if not l or l[0] == "#": + continue + tim, typ, tst, tri, sizestr, genstr, modstr = l.split() + size = int(sizestr) + 1 + gen = int(genstr) + mod = int(modstr, 16) + if size not in primes: + primes[size] = [] + primes[size].append((gen, mod)) + return primes |