TheAlgorithms / Python Public
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
a5/1 cipher added issue#4977 fixed #5356
base: master
Are you sure you want to change the base?
Conversation
Click here to look at the relevant links ⬇️
🔗 Relevant LinksRepository:
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 reviewto trigger the checks for only added pull request files@algorithms-keeper review-allto 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.
| reg_y = [] | ||
| reg_z = [] | ||
|
|
||
| def loading_registers(key): |
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: loading_registers. If the function does not return a value, please provide the type hint as: def function() -> None:
As there is no test file in this pull request nor any test function or class in the file ciphers/a51.py, please provide doctest for the function loading_registers
Please provide type hint for the parameter: key
| k = k + 1 | ||
| r = r + 1 | ||
|
|
||
| def set_key(key): |
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: set_key. If the function does not return a value, please provide the type hint as: def function() -> None:
As there is no test file in this pull request nor any test function or class in the file ciphers/a51.py, please provide doctest for the function set_key
Please provide type hint for the parameter: key
| return True | ||
| return False | ||
|
|
||
| def get_key(): |
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: get_key. If the function does not return a value, please provide the type hint as: def function() -> None:
As there is no test file in this pull request nor any test function or class in the file ciphers/a51.py, please provide doctest for the function get_key
| def get_key(): | ||
| return key_one | ||
|
|
||
| def to_binary(plain): |
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: to_binary. If the function does not return a value, please provide the type hint as: def function() -> None:
As there is no test file in this pull request nor any test function or class in the file ciphers/a51.py, please provide doctest for the function to_binary
Please provide type hint for the parameter: plain
| return binary_values | ||
|
|
||
|
|
||
| def get_majority(x,y,z): #gets majority by adding up the x,y,and z values and if it's greater than 1 (e.g. two 1's and one 0), it returns the majority (1). Otherwise, if it's two 0's and one 1, the majority is returned as 0. |
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: get_majority. If the function does not return a value, please provide the type hint as: def function() -> None:
As there is no test file in this pull request nor any test function or class in the file ciphers/a51.py, please provide doctest for the function get_majority
Please provide type hint for the parameter: x
Please provide descriptive name for the parameter: x
Please provide type hint for the parameter: y
Please provide descriptive name for the parameter: y
Please provide type hint for the parameter: z
Please provide descriptive name for the parameter: z
| i = i + 1 | ||
| return convert_binary_to_str(str(s)) | ||
|
|
||
| def user_input_key(): |
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: user_input_key. If the function does not return a value, please provide the type hint as: def function() -> None:
As there is no test file in this pull request nor any test function or class in the file ciphers/a51.py, please provide doctest for the function user_input_key
| tha_key = str(input('Enter a 64-bit key: ')) | ||
| return tha_key | ||
|
|
||
| def user_input_choice(): |
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: user_input_choice. If the function does not return a value, please provide the type hint as: def function() -> None:
As there is no test file in this pull request nor any test function or class in the file ciphers/a51.py, please provide doctest for the function user_input_choice
| inp = str(input('[0]: Quit\n[1]: Encrypt\n[2]: Decrypt\nPress 0, 1, or 2: ')) | ||
| return inp | ||
|
|
||
| def user_input_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: user_input_plaintext. If the function does not return a value, please provide the type hint as: def function() -> None:
As there is no test file in this pull request nor any test function or class in the file ciphers/a51.py, please provide doctest for the function user_input_plaintext
| inp = str(input('Try again: ')) | ||
| return inp | ||
|
|
||
| def user_input_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: user_input_ciphertext. If the function does not return a value, please provide the type hint as: def function() -> None:
As there is no test file in this pull request nor any test function or class in the file ciphers/a51.py, please provide doctest for the function user_input_ciphertext
| ciphertext = str(input('Enter a ciphertext: ')) | ||
| return ciphertext | ||
|
|
||
| def tha_main(): |
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: tha_main. If the function does not return a value, please provide the type hint as: def function() -> None:
As there is no test file in this pull request nor any test function or class in the file ciphers/a51.py, please provide doctest for the function tha_main
| def user_input_plaintext(): | ||
| try: | ||
| inp = str(input('Enter the plaintext: ')) | ||
| except: |
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.
| binary = to_binary(plain) | ||
| keystream = get_keystream(len(binary)) | ||
| i = 0 | ||
| while(i < len(binary)): |
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.
| while(i < len(binary)): | |
| while i < len(binary): |
As discussed in CONTRIBUTING.md, psf/black will reformat the code here and elsewhere.
| reg_x_length = 19 | ||
| reg_y_length = 22 | ||
| reg_z_length = 23 | ||
|
|
||
| key_one = "" | ||
| reg_x = [] | ||
| reg_y = [] | ||
| reg_z = [] |
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.
Do we really need all these global?
| import re | ||
| import copy | ||
| import sys |
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.
| import re | |
| import copy | |
| import sys | |
| import copy | |
| import re | |
| import sys |
Placate isort.


Describe your change:
Checklist:
Fixes: #{$ISSUE_NO}.The text was updated successfully, but these errors were encountered: