| Server IP : 77.68.64.21 / Your IP : 216.73.217.105 Web Server : Apache System : Linux hp3-wp-1011378.hostingp3.local 3.10.0-1160.144.1.el7.tuxcare.els9.x86_64 #1 SMP Fri Jul 10 17:06:31 UTC 2026 x86_64 User : csh2668128 ( 2112425) PHP Version : 8.1.34 Disable Function : shell_exec,exec,system,popen,set_time_limit MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/doc/m2crypto-0.21.1/demo/ |
Upload File : |
#!/usr/bin/python
"""DH demonstration.
Copyright (c) 1999-2003 Ng Pheng Siong. All rights reserved."""
from M2Crypto import DH, Rand
def test():
print 'generating dh params:'
a = DH.gen_params(128, 2)
b = DH.set_params(a.p, a.g)
a.gen_key()
b.gen_key()
print 'p = ', `a.p`
print 'g = ', `a.g`
print 'a.pub =', `a.pub`
print 'a.priv =', `a.priv`
print 'b.pub =', `b.pub`
print 'b.priv =', `b.priv`
print 'a.key = ', `a.compute_key(b.pub)`
print 'b.key = ', `b.compute_key(a.pub)`
if __name__=='__main__':
Rand.load_file('randpool.dat', -1)
test()
Rand.save_file('randpool.dat')