MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / __init__

Method __init__

ciphers/diffie_hellman.py:214–220  ·  view source on GitHub ↗
(self, group: int = 14)

Source from the content-addressed store, hash-verified

212
213 # Current minimum recommendation is 2048 bit (group 14)
214 def __init__(self, group: int = 14) -> None:
215 if group not in primes:
216 raise ValueError("Unsupported Group")
217 self.prime = primes[group]["prime"]
218 self.generator = primes[group]["generator"]
219
220 self.__private_key = int(hexlify(urandom(32)), base=16)
221
222 def get_private_key(self) -> str:
223 return hex(self.__private_key)[2:]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected