As a University research lab, we often have students who are not familiar with concepts that the professional security community finds second nature.
Something that I have to explain to new students very often is the concept of Endianness. A concept that reverse engineers and low-level programmers deal with on a daily basis, some students cannot even begin to grasp.
Because of this, we often have to come up with different ways to explain complex concepts to different students. Here’s some of what we’ve come up with for Endianness. Hopefully, this material will be useful to students trying to understand Endianness and teachers trying to explain Endianness and other concepts.
We find that some students don’t accept concepts until they understand how they came to be. For these students, we point them to the section on the Wikipedia page that talks about Jonathan Swift’s Gulliver’s Travels
Some students are fine with the concept, but are interested in why they came to be. For these students we provide the following analogy:
Big endian is to [English](http://en.wikipedia.org/wiki/English_language) as Little endian is to [Hebrew](http://en.wikipedia.org/wiki/Hebrew_language)
After explaining that while these languages are written and read in different directions, they are still both languages capable of expressing the same ideas. The creators of these languages may have had their own reasons for picking left or right (which we don’t care about at this juncture), but they both accomplish the same thing. The word size in this analogy is one line of text. See more about word size below.
Some students need to see it, instead of just hearing it be explained. This is fairly common and we often use the images on Wikipedia for demonstration:
These images explain how the same numeric value is stored differently in memory based on which endianness is being used. Recently, I found another insightful graphic in the Intel manuals:
This image gives a different take on little endian, showing how different values would read out of this contiguous segment of memory.
Some students will appear to understand the concept when discussing 4-byte values, but then when switching to 2-byte values it’s clear they really don’t understand the whole concept.
Word size is an important concept to make sure students understand when explaining Endianness. Depending on the size of data you’re working with, data will be written into and read out of memory differently. Students need to understand that architectures have a default data size, and the processor will use that size when reading and writing data in big or little endian.