Thursday, October 20, 2016

Converting Common Numeral Systems to BASE 10


A numeral system in a way to represent or express numbers using digits or other symbols in a consistent manner.

The most widely used numeral system by people is decimal, or BASE 10.

Definitions


10^4

In the example above, the number 10 is called the BASE (or radix / root), and the number 4 is called the exponent. The exponent corresponds to the number of times the base is used as a factor (4 x 4 x 4 x 4).

Binary (0, 1) - used by logic gates in most digital circuits

To convert the binary number 1011 to decimal,

 1         0         1         1             # Your binary number
(1x2^3) + (0x2^2) + (1x2^1) + (1x2^0) # Multiply your number by the power of the base that the digit represents
   8    +    0    +    2    +    1    = 11   # Add the numbers together to get the result in BASE 10


Octal (0..7) - used often in computing

To convert the octal number 350 into decimal,

 3         5         0 # Your octal number
(3x8^2) + (5x8^1) + (0x8^0) # Multiply your number by the power of the base that the digit represents
  192   +   40    +    0    = 232 # Add the numbers together to get the result in BASE 10


Hexadecimal, hex (0..9, a..f) - used often in computing

To convert the hex number 1F20 into decimal,

 1   F      2     0 # Your hex number
(1x16^3) + (Fx16^2)  + (2x16^1) + (0x16^0) # Multiply your number by the power of the base that the digit represents
(1x16^3) + (15x16^2) + (2x16^1) + (0x16^0) # Convert the hex numbers into the decimal equivilent
4096     +  3840     +  32      +  0       = 7968 # Add the numbers together to get the result in BASE 10


Further Reading:

http://whatis.techtarget.com/definition/logic-gate-AND-OR-XOR-NOT-NAND-NOR-and-XNOR

Online Toolbox

Converter: http://coderstoolbox.net/number/
- Does string, number, time, network, and bandwidth conversion

Sunday, October 16, 2016

Security+ Certification

I recently passed the CompTIA Security+ ce exam. I've never been much on certifications, but I decided to take this test to formalize some of my knowledge. 

About the Test

There were 72 questions and I had 90 minutes to complete the test. This was enough time to complete the test and to fully review all of the questions. A few of the questions were 'simulation' questions and the rest were multiple choice. 

To prepare, I purchased the CertMaster training, which can be bought as an add-on when you purchase your exam voucher.  https://certification.comptia.org/training/certmaster/security


The above training takes ~15 hours to complete the initial 702 practice questions. I took the initial training, reviewed concepts that I did not know, and reviewed missed questions twice before taking the test.

A Hex Upon Numerals

BASE 16

0123456789abcdef

Definition

In mathematics and computing, hexadecimal (also base 16, or hex) is a positional numeral system with a radix, or base, of 16. It uses sixteen distinct symbols, most often the symbols 0–9 to represent values zero to nine, and A, B, C, D, E, F (or alternatively a, b, c, d, e, f) to represent values ten to fifteen. -- https://en.wikipedia.org/wiki/Hexadecimal

Notes

  • Hex numbers uses digits from 0..9 and A..F
  • 0xVALU  - Unix/C prefix
  • Other than 0xVALU, VALU16 is a common notation
  • Each character is the equivalent of a nibble (4 bits)

Converting hex (BASE 16) to decimal (BASE 10)

A byte can be represented as:

n·16^3 n·16^2 n·16^1 n·16^0

OR

n·4096 n·256 n·16 n·1

*Any nonzero number raised to the zero power is equal to one (i.e., n^0=1). This concludes that all nonzero numbers raised to the zero power are equivalent because they all equal 1. Note that it is any nonzero number, since 00 is undefined.

Conversion Examples

0x31 = (3·16^1)+(1·16^0) = (48) + (1) = 49
0xc9 = (12·16^1) + (9·16^0) = (192) + (9) = 201
0x1f = (1·16) + (15·1) = 31

Decimal to Hexadecimal to Binary Conversion Table

Dec Hex Bin
B10 B16  B2 
0 0 00000000
1 1 00000001
2 2 00000010
3 3 00000011
4 4 00000100
5 5 00000101
6 6 00000110
7 7 00000111
8 8 00001000
9 9 00001001
10 a 00001010
11 b 00001011
12 c 00001100
13 d 00001101
14 e 00001110
15 f 00001111
16 10 00010000
17 11 00010001
18 12 00010010
19 13 00010011
20 14 00010100

References




Binary is as easy as 1, 10, 11

Definition

Binary - In mathematics and digital electronics, a binary number is a number expressed in the binary numeral system or base-2 numeral system which represents numeric values using two different symbols: typically 0 (zero) and 1 (one).https://en.wikipedia.org/wiki/Binary_number

Notes

  • BASE 2 Counting method only uses 0 and 1
  • One binary digit is called a bit
  • Two digits are called a crumb, four digits are called a nibble, and eight digits are called a byte
  • Lower Case letters start with 011xxxxx
  • Upper Case letters start with 010xxxxx
  • When counting, range 0-1, carry the 1 (i.e. 00000000, 00000001, 00000010, 00000011, 00000100, 00000101, 00000110, 00000111, 00001000, 00001001, 00001010 ...)
  • 1+1=10

Converting binary (BASE 2) to decimal (BASE 10)

A byte can be represented as:

n·2^7 | n·2^6 | n·2^5 | n·2^4 | n·2^3 | n·2^2 | n·2^1 | n·2^0

OR

n·128 | n·64 | n·32 | n·16 | n·8 | n·4 | n·2 | n·1*

*Any nonzero number raised to the zero power is equal to one (i.e., n^0=1). This concludes that all nonzero numbers raised to the zero power are equivalent because they all equal 1. Note that it is any nonzero number, since 00 is undefined.

Conversion Examples

10 = 1·2^1 | 0·2^0 = 1·2 + 0·1 = 2
111 = 1·2^2 | 1·2^1 | 1·2^0 = 1·4 + 1·2 + 1·1 =7
1011 =  1·2^3 | 0·2^2 | 1·2^1 | 1·2^0 = 1·8 + 0 + 1·2 + 1 = 11

Converting binary (BASE 10) to decimal (BASE 2)

2^4 2^3 2^2 2^1 2^0
16 8 4 2 1

Use the value in the second row to count to the value--you can use each value no more than 1 time (since we count 0..1). For example, we want to convert 22 to binary. To do this we need:

(1 x 16) + (0x8) + (1x4) + (1x2) + (0x1)

10110 = 22

Letter to ASCII to Binary Character Table

LetterASCII CodeBinaryLetterASCII CodeBinary
a09701100001A06501000001
b09801100010B06601000010
c09901100011C06701000011
d10001100100D06801000100
e10101100101E06901000101
f10201100110F07001000110
g10301100111G07101000111
h10401101000H07201001000
i10501101001I07301001001
j10601101010J07401001010
k10701101011K07501001011
l10801101100L07601001100
m10901101101M07701001101
n11001101110N07801001110
o11101101111O07901001111
p11201110000P08001010000
q11301110001Q08101010001
r11401110010R08201010010
s11501110011S08301010011
t11601110100T08401010100
u11701110101U08501010101
v11801110110V08601010110
w11901110111W08701010111
x12001111000X08801011000
y12101111001Y08901011001
z12201111010Z09001011010

References