from os import urandom

"""
This module is used for the calculations for a Diffie-Hellman key exchange
this implementation uses the prime and generator described by the
4096-bit MODP Group id 16
Information available at: https://tools.ietf.org/html/rfc3526#section-5
"""


class DiffieHellman:

    def __init__(self):
        self.generator = 2
        self.prime = 0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF
        self.key_size = 8  # bytes
        self.key = int.from_bytes(urandom(self.key_size), byteorder="big")

    def get_public_key(self):
        return pow(self.generator, self.key, self.prime)

    def get_shared_key(self, public_key):
        return pow(public_key, self.key, self.prime)


f4431d58b0770f497e562cdfd419ce55f87fd2b4
<mask token>


class DiffieHellman:

    def __init__(self):
        self.generator = 2
        self.prime = (
            32317006071311007300338913926423828248817941241140239112842009751400741706634354222619689417363569347117901737909704191754605873209195028853758986185622153212175412514901774520270235796078236248884246189477587641105928646099411723245426622522193230540919037680524235519125679715870117001058055877651038861847280257976054903569732561526167081339361799541336476559160368317896729073178384589680639671900977202194168647225871031411336429319536193471636533209717077448227988588565369208645296636077250268955505928362751121174096972998068410554359584866583291642136218231078990999448652468262416972035911852507045361090559
            )
        self.key_size = 8
        self.key = int.from_bytes(urandom(self.key_size), byteorder='big')
    <mask token>
    <mask token>

<mask token>


class DiffieHellman:

    def __init__(self):
        self.generator = 2
        self.prime = (
            32317006071311007300338913926423828248817941241140239112842009751400741706634354222619689417363569347117901737909704191754605873209195028853758986185622153212175412514901774520270235796078236248884246189477587641105928646099411723245426622522193230540919037680524235519125679715870117001058055877651038861847280257976054903569732561526167081339361799541336476559160368317896729073178384589680639671900977202194168647225871031411336429319536193471636533209717077448227988588565369208645296636077250268955505928362751121174096972998068410554359584866583291642136218231078990999448652468262416972035911852507045361090559
            )
        self.key_size = 8
        self.key = int.from_bytes(urandom(self.key_size), byteorder='big')

    def get_public_key(self):
        return pow(self.generator, self.key, self.prime)
    <mask token>

<mask token>


class DiffieHellman:

    def __init__(self):
        self.generator = 2
        self.prime = (
            32317006071311007300338913926423828248817941241140239112842009751400741706634354222619689417363569347117901737909704191754605873209195028853758986185622153212175412514901774520270235796078236248884246189477587641105928646099411723245426622522193230540919037680524235519125679715870117001058055877651038861847280257976054903569732561526167081339361799541336476559160368317896729073178384589680639671900977202194168647225871031411336429319536193471636533209717077448227988588565369208645296636077250268955505928362751121174096972998068410554359584866583291642136218231078990999448652468262416972035911852507045361090559
            )
        self.key_size = 8
        self.key = int.from_bytes(urandom(self.key_size), byteorder='big')

    def get_public_key(self):
        return pow(self.generator, self.key, self.prime)

    def get_shared_key(self, public_key):
        return pow(public_key, self.key, self.prime)

from os import urandom
<mask token>


class DiffieHellman:

    def __init__(self):
        self.generator = 2
        self.prime = (
            32317006071311007300338913926423828248817941241140239112842009751400741706634354222619689417363569347117901737909704191754605873209195028853758986185622153212175412514901774520270235796078236248884246189477587641105928646099411723245426622522193230540919037680524235519125679715870117001058055877651038861847280257976054903569732561526167081339361799541336476559160368317896729073178384589680639671900977202194168647225871031411336429319536193471636533209717077448227988588565369208645296636077250268955505928362751121174096972998068410554359584866583291642136218231078990999448652468262416972035911852507045361090559
            )
        self.key_size = 8
        self.key = int.from_bytes(urandom(self.key_size), byteorder='big')

    def get_public_key(self):
        return pow(self.generator, self.key, self.prime)

    def get_shared_key(self, public_key):
        return pow(public_key, self.key, self.prime)

from os import urandom

"""
This module is used for the calculations for a Diffie-Hellman key exchange
this implementation uses the prime and generator described by the
4096-bit MODP Group id 16
Information available at: https://tools.ietf.org/html/rfc3526#section-5
"""


class DiffieHellman:

    def __init__(self):
        self.generator = 2
        self.prime = 0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF
        self.key_size = 8  # bytes
        self.key = int.from_bytes(urandom(self.key_size), byteorder="big")

    def get_public_key(self):
        return pow(self.generator, self.key, self.prime)

    def get_shared_key(self, public_key):
        return pow(public_key, self.key, self.prime)

