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

Method generate_public_key

ciphers/diffie_hellman.py:225–227  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

223 return hex(self.__private_key)[2:]
224
225 def generate_public_key(self) -> str:
226 public_key = pow(self.generator, self.__private_key, self.prime)
227 return hex(public_key)[2:]
228
229 def is_valid_public_key(self, key: int) -> bool:
230 # check if the other public key is valid based on NIST SP800-56

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected