-
-
Notifications
You must be signed in to change notification settings - Fork 46.7k
Algo added #11869
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
Algo added #11869
Conversation
* Used in cryptography, the RSA algorithm is known for its complexity in terms of factoring large prime numbers
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.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper
commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper review
to trigger the checks for only added pull request files@algorithms-keeper review-all
to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
other/RSA_Algo/rsa_algo.py
Outdated
import sys | ||
from sympy import isprime, mod_inverse | ||
|
||
def generate_prime_candidate(length): |
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 provide return type hint for the function: generate_prime_candidate
. If the function does not return a value, please provide the type hint as: def function() -> None:
Please provide type hint for the parameter: length
other/RSA_Algo/rsa_algo.py
Outdated
p = random.getrandbits(length) | ||
return p | ||
|
||
def generate_keys(keysize): |
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 provide return type hint for the function: generate_keys
. If the function does not return a value, please provide the type hint as: def function() -> None:
Please provide type hint for the parameter: keysize
other/RSA_Algo/rsa_algo.py
Outdated
print(f"Unexpected error generating keys: {ex}", file=sys.stderr) | ||
sys.exit(1) | ||
|
||
def gcd(a, b): |
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 provide return type hint for the function: gcd
. If the function does not return a value, please provide the type hint as: def function() -> None:
Please provide type hint for the parameter: a
Please provide descriptive name for the parameter: a
Please provide type hint for the parameter: b
Please provide descriptive name for the parameter: b
other/RSA_Algo/rsa_algo.py
Outdated
a, b = b, a % b | ||
return a | ||
|
||
def encrypt(pk, plaintext): |
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 provide return type hint for the function: encrypt
. If the function does not return a value, please provide the type hint as: def function() -> None:
Please provide type hint for the parameter: pk
Please provide type hint for the parameter: plaintext
other/RSA_Algo/rsa_algo.py
Outdated
print(f"Unexpected error during encryption: {ex}", file=sys.stderr) | ||
return None | ||
|
||
def decrypt(pk, ciphertext): |
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 provide return type hint for the function: decrypt
. If the function does not return a value, please provide the type hint as: def function() -> None:
Please provide type hint for the parameter: pk
Please provide type hint for the parameter: ciphertext
aed2d40
to
6b3f930
Compare
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.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper
commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper review
to trigger the checks for only added pull request files@algorithms-keeper review-all
to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
print(f"Unexpected error generating keys: {ex}", file=sys.stderr) | ||
sys.exit(1) | ||
|
||
def gcd(a: int, b: int) -> int: |
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 provide descriptive name for the parameter: a
Please provide descriptive name for the parameter: b
4b01834
to
452470a
Compare
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.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper
commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper review
to trigger the checks for only added pull request files@algorithms-keeper review-all
to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
print(f"Arithmetic error generating keys: {ex}", file=sys.stderr) | ||
sys.exit(1) | ||
|
||
def gcd(a: int, b: int) -> int: |
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 provide descriptive name for the parameter: a
Please provide descriptive name for the parameter: b
for more information, see https://pre-commit.ci
Closing require_descriptive_names PRs to prepare for Hacktoberfest |
Describe your change:
The RSA algorithm is a widely used public-key cryptosystem that enables secure data transmission. It involves generating a pair of keys: a public key for encryption and a private key for decryption. The program you have generates these keys, encrypts a message, and then decrypts it.
https://spyscape.com/article/can-you-crack-these-10-mind-boggling-ciphers-and-codes
Checklist: