Skip to content
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

Documentation and optimization of functions #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

GuilhermeMonteiroPeixoto

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.

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.
@adrg
Copy link
Owner

adrg commented Jan 5, 2023

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants