-
-
Notifications
You must be signed in to change notification settings - Fork 46.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Simplify diffie_hellman.py #12541
base: master
Are you sure you want to change the base?
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: