ASCII Representations
What you'll need:
- A text editor (anything simple like Notepad will do)
- A hex editor, there are plenty for all operating systems, but here are a few:
- Get used to writing notes in investigations (and exercises), so make sure you have pen and paper or an easy electronic mean to record notes
Create a Plaintext ASCII File
- Open your text editor of choice (don't use Word or similar!)
- Write the following exactly as you see it here (substitute the YY for the current year) and save the file when done
Hello Friend!
The year ends on every 31st of December. This year it'll be on 31/12/YY.
It's tempting, but don't make use of the copy-paste function when you hover your mouse over the above text. These convenience functions can introduce hidden characters that you can't see with your eyes, but will copy them into you editor anyway, and therefore might result in your file being different than intended for this exercise.
Explore the File and Editor
- Locate the file you just created and find out the file's size in bytes
- Start your editor of choice and figure out how to load the file you created just now
- Depending on your editor, you will usually see a view that is split in two, can you identify which side shows what?
Offset
The left most column (in all hex editors) shows the offset of the data.
An offset shows the position of the value in the data, relative to the beginning
- Try to figure out how offsets work (it might not always be obvious)
- If you're stuck, signal your tutor
Offsets are often written as 0xNN
where NN
is a number. For example, the beginning of the file loaded will be 0x00
, the last should be 0x57
.
- Can you figure out how I've arrived at
0x57
?
Hint: Columns are as important as rows in determining the offset! And remember, we generally start counting from
0
in computing.
Locating Data
Remember, characters that your eyes read are different from how the computer reads them.
-
Locate
H
, fromHello World
, so first character- Note down the hex value for the character
- Note down the offset for the character
-
Locate
!
- Note down the hex value for the character
- Note down the offset for the character
-
Locate
y
, from the second occurrence ofyear
- Note down the hex value for the character
- Note down the offset for the character
-
Count the bytes in the file. Does it match the size you identified earlier?
-
Find out what
Unicode
is, particularlyUTF-8
andUTF-16
(we'll encounter and discuss those as we move through module material)- What's the difference to ASCII?