In this lesson, students will learn about ASCII encoding of text. Students will also look at how binary numbers can be used to store and transmit data on computer systems.
All data is stored as binary 0s and 1s on a computer. This means that every image, video, document, and program we use on a computer is ultimately converted to binary. Looking at text is a way to see this process in a clear, understandable way.
- Convert text to ASCII Numbers
- Convert base-10 numbers to base-2 binary
- Encode/decode a message using ASCII/Binary
- Print the Code.org Flippy Do
- Print the ASCII Encoding Worksheet
- Print the Binary Conversion Worksheet
- Print the ASCII Hex Decoding Worksheet
- Download the AsciiEncoding.py python file.
- For the Teacher
- For the Students
- Binary Number Game
- https://studio.code.org/projects/applab/iukLbcDnzqgoxuu810unLw
Number System: A method of representing numbers. Base-10: Our normal number system, 10 digits (0-9) can be in any number position Base-2: Binary number system only uses digits 0, 1 in any number position. ASCII: American Standard Code for Information Interchange - A method for representing every letter as a number.
- Discussion of how all data is stored as numbers in base-2 (binary) on a computer
The digits are stored as electrical pulses, magnetic poles in a Hard Drive, pits on a CD even as pulses of light. In all of these cases, there is a case that represents a 0 or 1.
As such, every bit of data is ultimately represented as binary numbers.
- Binary Numbers Video https://www.youtube.com/watch?v=1GSjbWt0c9M
- ASCII, Unicode, UTF8 encoding video https://www.youtube.com/watch?v=MijmeoH9LT4
Students will convert a message to ASCII using the chart. These will be base-10 numbers for now. Students will also decode a message and create their own message to swap and decode with another student.
Then students will convert a series of binary numbers to base-10 and back to text.
Python Programming:
- Using the AsciiEncoding.py as template:
- Create a text to ASCII to binary converter
- Try to convert each letter to the ASCII equivalent.
Discussion
-
If all data is stored as 0s and 1s, how does a computer know if a file is text or a picture?
-
I can put a password on a document so it can't be opened. If someone can see the 0s and 1s, what prevents someone from seeing the contents of that document? A password-protected documents is still stored as binary on the hard drive.
- Every letter is represented by a number, so is every color, sound, or program.
- If a color is a combination of red, green, and blue values (0-255), devise a way to hide text as an image.
Cyber Security Curriculum is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.