-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Add diffie hellman key exchange #615
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add diffie hellman key exchange #615
Conversation
…diffie_hellman_key_exchange
…diffie_hellman_key_exchange Update local branch with master branch
|
To implement DH key exchange, prime_check.py (written by 'goswami-rahul' and 'Hai Honag Dang') and euler_totient function (written by 'goswami-rahul') is needed. Again, Please let me know if such usage is problematic. |
| print ("Private key of Alice = %d" % a_pr_k) | ||
| print ("Public key of Alice = %d" % a_pu_k) |
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.
could you make the print statements optional?
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.
[Edit] Add optional parameter, and those statements only appears when that parameter is given.
I left shared-key print statements for comparison.
Do you think those statements should be optional also?
Please let me hear your opinion. Thanks.
| p_root_list.index(a) | ||
| except ValueError as e: | ||
| print("%d is not a primitive root of %d" % (a, p)) | ||
| return -1 |
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.
please raise error in this case so we can only return bool type.
If a function returns two types (-1, bool) the caller needs to branch out by the return type.
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.
[Edit] For primitive root case, code now return False, for consistency
Merge branch 'master' of https://github.com/keon/algorithms into add_diffie_hellman_key_exchange
…tency (return Bool only)
…diffie_hellman_key_exchange
|
thanks so much for the contribution! |
(Put an
Xinside the[ ]to denote check mark[X].)If creating a new file :
if done some changes :
other