Feb 17, 2025 | 226 words | 2 min read
11.2.3. Task 3#
Learning Objectives#
Convert a binary message into readable text.
Task Instructions#
Save the flowcharts for this task in tp1_team_3_teamnumber.pdf You will also need to include these flowcharts in your final report.
Write Python code that converts a binary string into ASCII text. Each character in the message is represented by 8 bits (1 byte). Convert each byte into its corresponding ASCII character and append it to a final message string. Name this program tp1_team_3_partial_teamnumber.py.
Sample Output
Use the values in Table 11.13 below to test your program.
Table 11.13 Test Cases# Case
binary text
1
0100100001100101011011000110110001101111
2
0111011101101111011100100110110001100100
Ensure your program’s output matches the provided samples exactly. This includes all characters, white space, and punctuation. In the samples, user input is highlighted like this for clarity, but your program should not highlight user input in this way.
Case 1 Sample Output
$ python3 tp1_team_3_teamnumber.py Enter the binary message: 0100100001100101011011000110110001101111 Converted Text: Hello
Case 2 Sample Output
$ python3 tp1_team_3_teamnumber.py Enter the binary message: 0111011101101111011100100110110001100100 Converted Text: world
Integrate this code into the LSB extraction code from Task 2 to extract and display the hidden message in a human-readable format. Name this program tp1_team_3_teamnumber.py.
Sample Output
Use the values in Table 11.14 below to test your program.
Table 11.14 Test Cases# Case
image_path
start_seq
end_seq
1
ref_col_p.png
123
*&^
2
ref_gry_p.png
abc
789
3
ref_gry_p.png
000
777
Ensure your program’s output matches the provided samples exactly. This includes all characters, white space, and punctuation. In the samples, user input is highlighted like this for clarity, but your program should not highlight user input in this way.
Case 1 Sample Output
$ python3 tp1_team_3_teamnumber.py Enter the path of the image you want to load: ref_col_p.png Enter the start sequence: 123 Enter the end sequence: *&^ Below is the img_array output of ref_col_p.png: Extracted Message: 011100110110010101100011011100100110010101110100 Converted Text: secret
Case 2 Sample Output
$ python3 tp1_team_3_teamnumber.py Enter the path of the image you want to load: ref_gry_p.png Enter the start sequence: abc Enter the end sequence: 789 Below is the img_array output of ref_gry_p.png: Extracted Message: 0110100001100101011011000110110001101111 Converted Text: hello
Case 3 Sample Output
$ python3 tp1_team_3_teamnumber.py Enter the path of the image you want to load: ref_gry_p.png Enter the start sequence: 000 Enter the end sequence: 777 Below is the img_array output of ref_gry_p.png: Start or end sequence not found in the image.
Deliverables |
Description |
---|---|
tp1_team_3_teamnumber.py |
Your completed Python code. |
tp1_team_3_teamnumber.pdf |
Flowchart(s) for this task. |