diffiehellman icon indicating copy to clipboard operation
diffiehellman copied to clipboard

echo_return_key didn't work

Open NashMiao opened this issue 7 years ago • 0 comments

I add some code in the example:

#!/usr/bin/env python3
# -*- coding: utf-8 -*-


from diffiehellman.diffiehellman import DiffieHellman

alice = DiffieHellman(group=18, key_length=1024)
bob = DiffieHellman(group=18, key_length=1024)

alice.generate_public_key()  # automatically generates private key
bob.generate_public_key()

shared_key1 = alice.generate_shared_secret(bob.public_key, echo_return_key=True)
print(shared_key1)
shared_key2 = bob.generate_shared_secret(alice.public_key, echo_return_key=True)
print(shared_key2)
a = alice.shared_key
print(a)
b = bob.shared_key
print(b)

but the output are the following:

None
None
59afb911e9878441a86091d3a527a77aa4050ae7746e10a55a56ed162c0b218d
59afb911e9878441a86091d3a527a77aa4050ae7746e10a55a56ed162c0b218d

I can't find out why the return value didn't assign to the shared_key1 and shared_key2.

NashMiao avatar Aug 02 '18 06:08 NashMiao