Skip to content

Documentation and optimization of functions#2

Open
GuilhermeMonteiroPeixoto wants to merge 1 commit into
adrg:masterfrom
GuilhermeMonteiroPeixoto:patch-1
Open

Documentation and optimization of functions#2
GuilhermeMonteiroPeixoto wants to merge 1 commit into
adrg:masterfrom
GuilhermeMonteiroPeixoto:patch-1

Conversation

@GuilhermeMonteiroPeixoto

Copy link
Copy Markdown

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

adrg commented Jan 5, 2023

Copy link
Copy Markdown
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?

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