Questions about this topic? Sign up to ask in the talk tab.

Byte

From NetSec
Revision as of 02:46, 16 November 2011 by Gonzalo58T (Talk | contribs) (Expanded and made more exact)

Jump to: navigation, search

A byte represents (most often) 8 (can be 10, 12, 15... depending on your architecture) bits of data. A bit of data is simply a 1 or 0, that may represent an "off" or "on" state, or whatever the programmer decides.

Representation

8-bits bytes are typically described by two hexadecimal characters.

Hexadecimal is often notated with character ranges from 0 to 9 and then from A F. A represents "10", B 11, C 12, D 13, E 14, F 15.

How to read an hexadecimal number, and a byte

Savitri says
Just like decimal numbers, you epsilons!

Let's take a random byte: 11010011

In hexadecimal, it is: D3

Hexadecimal, means (that's greek) "radix 16", or more commonly "base 16".

So this means, reading from right to left, the first ranking number will be multipled by 16^0 (equals 1), second ranking number will be multipled by 161 (equals 16), third by 162, nth by 16n+1...

  • 3 in hexadecimal is 3 in decimal, too (how surprising!)
  • D in hexadecimal is 13 in decimal, too.

So to convert this number to base 10, we compute:

3 * 1 + 13 * 16 = 3 + 208 = 211


Reference

  0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F
  0   1   2   3   4   5   6   7   8   9   10  11  12  13  14  15