Big Endian and Little Endian in Pictures

By | February 12, 2016

Big-Endian.svgYou may have come across this image on Wikipedia when reading about endianness. While it is great, in practice when I’m viewing content in memory, it is displayed horizontally instead of vertically. So for those visual people out there, here is another take.

 

 

 

Big endian is defined at placing the Most Significant Figure (MSF) and placing it in the lowest memory address. (In this case a). Little endian is placing the Least Significant Figure (LSF) in the lowest memory address.Screen Shot 2016-02-12 at 11.25.44 AM

The sha256 of the character “a” is: ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb. Below is how it is represented in memory.   Note that the result has been truncated to show only 16 bytes and I’m using an intel based PC which is little endian by default.

Printing the variable S shows little endian meaning you can read the output from left to right.

Screen Shot 2016-02-12 at 10.41.48 AM

The hash variable beneath it shows the result in big endian.

Summary

It is easy to get confused so the secret that I have found is to keep a reference chart or your favourite web link handy to refer to when required.

Speaking of web link, this is a cool write up from another angle.

One thought on “Big Endian and Little Endian in Pictures

  1. donPablo

    The diagram with crossed arrows is really LITTLE Endian, as in Intel cpus.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *