Simplify diffie_hellman.py - #12541
Conversation
Everything is a refactor except the method generate_shared_key(). Its hashing final step has been removed for simplicity
group: int -> prime: int, generator: int
|
These are many unrelated changes. Let me know if I have to divide them into commits or PRs. |
|
The git history shows that the author is @ruppysuppy . Do these changes seem good to you? Everything is a refactor except the method |
ruppysuppy
left a comment
There was a problem hiding this comment.
@isidroas I am happy with the changes, but slightly unsure about this - my thoughts related to cryptography is a bit rusty (hadn't touched the topic in a while), so a brief explanation would be great
| Both parties should agree on the same public parameters | ||
| >>> bob = DiffieHellman(alice.prime, alice.generator) |
There was a problem hiding this comment.
Are we generating Bob's data using Alice's prime? Isn't the prime supposed to be private?
There was a problem hiding this comment.
The only secret attribute is each self.__private_key, which does not necessarily have to be a prime number. In cryptography it is strange that more than one parameter must be kept secret.
|
Thank you for the feedback @ruppysuppy ! I added a bit of documentation in 93c7ac0 |
Describe your change:
Checklist: