write-up(crypto)/G04T
[G04T] Diffie-Hellman
from Crypto.Util.number import getPrime from Crypto.Util.Padding import pad, unpad from Crypto.Cipher import AES import hashlib import random class Person(object): def __init__(self, p): self.p = p self.g = 2 self.x = random.randint(2, self.p - 1) def calc_key(self): self.k = pow(self.g, self.x, self.p) return self.k def set_shared_key(self, k): self.sk = pow(k, self.x, self.p) print("sk : ",sel..