From 68887062f4bbeb69a3067d8c1179a3c8311e61cc Mon Sep 17 00:00:00 2001 From: Joseph Alan Date: Wed, 22 Feb 2023 14:53:00 +0530 Subject: [PATCH 1/2] Fixed typos in two files --- CONTRIBUTING.md | 2 +- algorithms/matrix/matrix_exponentiation.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3ccd4eb6c..6eac6c029 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,7 +11,7 @@ agree to abide by the [Code of Conduct](CODE_OF_CONDUCT.md). * After that create a branch for your changes. For example: * add_XXX if you will add new algorithms or data structures. - * fix_XXX if you will fixe a bug on a certain algorithm or data structure. + * fix_XXX if you will fix a bug on a certain algorithm or data structure. * test_XXX if you wrote a test/s. * doc_XXX if you added to or edited documentation. diff --git a/algorithms/matrix/matrix_exponentiation.py b/algorithms/matrix/matrix_exponentiation.py index 2c836fe07..d9b45ba21 100644 --- a/algorithms/matrix/matrix_exponentiation.py +++ b/algorithms/matrix/matrix_exponentiation.py @@ -1,6 +1,6 @@ def multiply(matA: list, matB: list) -> list: """ - Multiplies two square matrices matA and matB od size n x n + Multiplies two square matrices matA and matB of size n x n Time Complexity: O(n^3) """ n = len(matA) From 4f0083030827a227c5327e560614e72d037141fd Mon Sep 17 00:00:00 2001 From: joseph-alan-jose Date: Fri, 10 Mar 2023 16:35:53 +0530 Subject: [PATCH 2/2] fixed typos --- .../maths/diffie_hellman_key_exchange.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/algorithms/maths/diffie_hellman_key_exchange.py b/algorithms/maths/diffie_hellman_key_exchange.py index b70b000af..83685014b 100644 --- a/algorithms/maths/diffie_hellman_key_exchange.py +++ b/algorithms/maths/diffie_hellman_key_exchange.py @@ -94,52 +94,52 @@ def find_primitive_root(n): """ Diffie-Hellman key exchange is the method that enables two entities (in here, Alice and Bob), not knowing each other, -to share common secret key through not-encrypted communication network. -This method use the property of one-way function (discrete logarithm) +to share common secret key through a non-encrypted communication network. +This method uses the property of one-way function (discrete logarithm). For example, given a, b and n, it is easy to calculate x that satisfies (a^b) ≡ x (mod n). However, it is very hard to calculate x that satisfies (a^x) ≡ b (mod n). -For using this method, large prime number p and its primitive root a +For using this method, a large prime number p and its primitive root a must be given. """ def alice_private_key(p): - """Alice determine her private key + """Alice determines her private key in the range of 1 ~ p-1. This must be kept in secret""" return randint(1, p-1) def alice_public_key(a_pr_k, a, p): - """Alice calculate her public key + """Alice calculates her public key with her private key. This is open to public""" return pow(a, a_pr_k) % p def bob_private_key(p): - """Bob determine his private key + """Bob determines his private key in the range of 1 ~ p-1. This must be kept in secret""" return randint(1, p-1) def bob_public_key(b_pr_k, a, p): - """Bob calculate his public key + """Bob calculates his public key with his private key. This is open to public""" return pow(a, b_pr_k) % p def alice_shared_key(b_pu_k, a_pr_k, p): - """ Alice calculate secret key shared with Bob, + """ Alice calculates secret key shared with Bob, with her private key and Bob's public key. This must be kept in secret""" return pow(b_pu_k, a_pr_k) % p def bob_shared_key(a_pu_k, b_pr_k, p): - """ Bob calculate secret key shared with Alice, + """ Bob calculates secret key shared with Alice, with his private key and Alice's public key. This must be kept in secret""" return pow(a_pu_k, b_pr_k) % p