<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.swganh.org/index.php?action=history&amp;feed=atom&amp;title=Packet%3AHexBinary</id>
		<title>Packet:HexBinary - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.swganh.org/index.php?action=history&amp;feed=atom&amp;title=Packet%3AHexBinary"/>
		<link rel="alternate" type="text/html" href="https://wiki.swganh.org/index.php?title=Packet:HexBinary&amp;action=history"/>
		<updated>2026-04-07T01:04:34Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.26.4</generator>

	<entry>
		<id>https://wiki.swganh.org/index.php?title=Packet:HexBinary&amp;diff=1663&amp;oldid=prev</id>
		<title>Snow at 00:36, 9 December 2006</title>
		<link rel="alternate" type="text/html" href="https://wiki.swganh.org/index.php?title=Packet:HexBinary&amp;diff=1663&amp;oldid=prev"/>
				<updated>2006-12-09T00:36:17Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This page is a summary of basic binary and hexadecimal number systems to help&lt;br /&gt;
understand packet analysis. These skills are essential tools to be a successful&lt;br /&gt;
analyzer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
BINARY NUMBERS:&lt;br /&gt;
&lt;br /&gt;
Binary numbers are a base 2 number system that consist of 0's and 1's, which usually represent voltage, or no voltage on a computer system.&lt;br /&gt;
&lt;br /&gt;
0 0 0 0 0 0 0 0 0    &lt;br /&gt;
&lt;br /&gt;
Each number is commonly called a &amp;quot;bit&amp;quot;. 8 bits is equal to a single byte, which is the most common form of data. &lt;br /&gt;
All data is made up of bytes.&lt;br /&gt;
&lt;br /&gt;
To calculate an integer number in decimal (base 10, what we commonly use), we add each 1 bit as a representation of the power of 2. &lt;br /&gt;
The following powers are used as 2 ^ N, where N is the place holder.&lt;br /&gt;
&lt;br /&gt;
_  _  _  _  _  _  _  _&lt;br /&gt;
7  6  5  4  3  2  1  0&lt;br /&gt;
&lt;br /&gt;
so 0 0 0 0 1 1 0 1 is equal to 2^0 + 2^2 + 2^3 = 13&lt;br /&gt;
&lt;br /&gt;
to more easily add it up, think of:&lt;br /&gt;
 _  _  _  _  _ _ _ _&lt;br /&gt;
128 64 32 16 8 4 2 1 &lt;br /&gt;
&lt;br /&gt;
and just add the numbers when the bit is 1&lt;br /&gt;
&lt;br /&gt;
so..&lt;br /&gt;
&lt;br /&gt;
0 1 0 1 0 1 1 1 is.. 64 + 16 + 4 + 2 + 1 = 87&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
HEXADECIMAL NUMBERS:&lt;br /&gt;
&lt;br /&gt;
Because binary numbers can get VERY long, hexadecimal, a base 16 number system is used. Because 16 is a power of 2, &lt;br /&gt;
it works out nicely. Intead of 0-9 like decimal uses, hexadecimal uses 0-F, which is just 0-9 with the &lt;br /&gt;
additon of A B C D E F as digits. Most data viewed on computers is in hexadecimal. &lt;br /&gt;
To convert from binary to hexadecimal and vice versa, use the following method:&lt;br /&gt;
&lt;br /&gt;
Each digit represents 1/2 of a byte. so 2 hexacedimal numbers is equal to 1 byte. So devide your &amp;quot;bits&amp;quot; into two groups.&lt;br /&gt;
Lets use the example from above.&lt;br /&gt;
&lt;br /&gt;
0 1 0 1     0 1 1 1&lt;br /&gt;
&lt;br /&gt;
Now, add them up seperatly:&lt;br /&gt;
&lt;br /&gt;
 5             7&lt;br /&gt;
&lt;br /&gt;
and there you go, your hexadecimal representation is 0x57. 0x is a common prefix to writing the numbers to let readers &lt;br /&gt;
know it is base 16.0x57 is not equal to 57, rather it is equal to 87. So where do the letters come in? &lt;br /&gt;
Well lets do another example:&lt;br /&gt;
&lt;br /&gt;
1 1 0 0 1 0 1 1  = 128 + 64 + 8 + 2 + 1 = 203&lt;br /&gt;
&lt;br /&gt;
1 1 0 0   1 0 1 1  BINARY&lt;br /&gt;
 12        11      DECIMAL&lt;br /&gt;
 C         B       HEX&lt;br /&gt;
&lt;br /&gt;
so 203 is equal to 0xCB in hexadecimal.&lt;br /&gt;
&lt;br /&gt;
TIP: You can use windows calculator to do these convesions quickly. Just change the mode to scientific.&lt;br /&gt;
&lt;br /&gt;
For simplicity of this article, signed (positive and negative) are not covered, as well as floating point numbers. &lt;br /&gt;
You can google the following examples for further research.&lt;br /&gt;
&lt;br /&gt;
Signed numbers : &amp;quot;Two's complement&amp;quot;&lt;br /&gt;
Floats : &amp;quot;IEEE Floating Point&amp;quot;&lt;br /&gt;
&lt;br /&gt;
TIP: Also, if these guides do not suffice or are confusing, use google for better explainations, &lt;br /&gt;
Wikipedia has A LOT more information on all of the subjects in this document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
DATA TYPES:&lt;br /&gt;
&lt;br /&gt;
C++ uses the following data types: These are the sizes in bytes they take to store, and these units are commonly &lt;br /&gt;
used throughout the rest of our documentation. These apply for both signed and unsigned (positive and negative)&lt;br /&gt;
&lt;br /&gt;
CHAR		1 Byte		(8 bit integer)&lt;br /&gt;
SHORT		2 Bytes		(16 bit integer)&lt;br /&gt;
INT		4 Bytes		(32 bit integer)&lt;br /&gt;
LONG		8 Bytes		(64 bit integer)&lt;br /&gt;
FLOAT		4 BYtes		(32 bit floating point)&lt;br /&gt;
&lt;br /&gt;
NOTE: LONG is commonly represented as &amp;quot;long long&amp;quot; while &amp;quot;long&amp;quot; by itself is interpreted as a 32 bit (4 byte) &lt;br /&gt;
int on GCC and other ANSI standard compilers. For the sake of shortness however, &lt;br /&gt;
we will refer &amp;quot;LONG&amp;quot; as a 64 bit (8 byte) integers.&lt;br /&gt;
&lt;br /&gt;
TIP: For information on maximum numerical storage capacity of each data type as signed or unsigned, use google,&lt;br /&gt;
it is readily available on the internet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
HOST BYTE vs NET BYTE ORDERS:&lt;br /&gt;
&lt;br /&gt;
This is also known as Big Endian vs Little Endian, and they are just a standard for reading multiple byte integers.&lt;br /&gt;
&lt;br /&gt;
HOST BYTE ORDER or BIG ENDIAN is a format that has the higher value byte to the right, and lower value byte to the left. &lt;br /&gt;
to Represent the number 1 as a SHORT or INT is as follows:&lt;br /&gt;
 &lt;br /&gt;
0x0100		(SHORT)&lt;br /&gt;
0x01000000	(INT)&lt;br /&gt;
&lt;br /&gt;
if this is confusing to understand, think of the 1000's, 100's, 10's, and 1's place in our decimal number system. We go:&lt;br /&gt;
&lt;br /&gt;
1000's   100's    10's     1's&lt;br /&gt;
&lt;br /&gt;
Higher value to the left, lower value to the right.&lt;br /&gt;
Now just apply this same method to hexadecimal. However, host byte has this reversed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NET BYTE ORDER or LITTLE ENDIAN is the exact opposite. It's larger value is to the left, and lower value to the right, &lt;br /&gt;
exactly like our decimal number system above. The number 1 as a SHORT or INT is as follows:&lt;br /&gt;
&lt;br /&gt;
0x0001		(SHORT)&lt;br /&gt;
0x00000001	(INT)&lt;br /&gt;
&lt;br /&gt;
Windows commonly uses HOST BYTE, Unix/Linux use NET BYTE. Most of our packets deal with HOST BYTE for INTs and SHORTs. &lt;br /&gt;
However some of the protocol uses NET BYTE. It will be specified which order is used in the packet breakdown documentations. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is just a summary of the common information that is assumed to be understood throughout the rest of our documentation. &lt;br /&gt;
If you have any specific questions, as someone, or use you're best friend Google (or his friend Wikipedia). &lt;br /&gt;
&lt;br /&gt;
www.Google.com&lt;/div&gt;</summary>
		<author><name>Snow</name></author>	</entry>

	</feed>