Documentation and optimization of functions#2
Open
GuilhermeMonteiroPeixoto wants to merge 1 commit into
Open
Conversation
Here are some changes that were made to the functions extract_length, extract_message, embed, and extract to optimize them: In the extract_length function, a list for storing the bits was initialized and the way bits are added to the list was modified. Instead of using the bits_from_bytes function, bits are added directly from the pixel components using the "&" operator with the number 1 to get the least significant of each pixel component. In the extract_message function, the logic for adding bits to the list was modified in the same way as in the extract_length function. In addition, a check was added to stop iterating through the pixels as soon as the list of bits reaches the length of the message. In the embed function, the way the list of bits is initialized was modified to check if a key argument was provided. If it was, the message is encrypted before being converted to bits. If not, the message is converted to bits directly. In the extract function, a check was added to verify if a key argument was provided. If it was, the message is decrypted after being extracted from the image. If not, the message is displayed directly.
Owner
|
@GuilhermeMonteiroPeixoto Thank you for the PR. The code documentation is spot on. I don't see the optimization changes you mentioned in the description though. Was there another commit with those? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Here are some changes that were made to the functions extract_length, extract_message, embed, and extract to optimize them:
In the extract_length function, a list for storing the bits was initialized and the way bits are added to the list was modified. Instead of using the bits_from_bytes function, bits are added directly from the pixel components using the "&" operator with the number 1 to get the least significant of each pixel component.
In the extract_message function, the logic for adding bits to the list was modified in the same way as in the extract_length function. In addition, a check was added to stop iterating through the pixels as soon as the list of bits reaches the length of the message.
In the embed function, the way the list of bits is initialized was modified to check if a key argument was provided. If it was, the message is encrypted before being converted to bits. If not, the message is converted to bits directly.
In the extract function, a check was added to verify if a key argument was provided. If it was, the message is decrypted after being extracted from the image. If not, the message is displayed directly.