Transcript Document

DFSC 1317 Introduction to
Digital Forensics and
Information Assurance
02
NUMBERING SYSTEMS:
BINARY, DECIMAL, AND
HEXADECIMAL
Basic operation performed by a
computer
2
 Arithmetic Operations: Addition, subtraction,
multiplication and division
 Logical operations: the sign or the comparative
magnitude of two numbers
 Data transfer: Moving data from one location to
another in the memory.
 Input-output operations: Controlling the
reading/writing of information into or out of the
computer
On Digital Computers
3
Digital computers store numbers in an entity (or
unit) called a word which consists of a string of
binary digits, or bits. Various number systems
are used to represent mathematical numbers.
Some commonly used number systems are:
hexadecimal (base 16), decimal (base 10), octal
(base 8), and binary (base 2). For example, in a
decimal system the number 8,410 is represented
in powers of ten as:
8103 + 4102 +1101 + 0100 = 8000 + 400 + 10
+ 0 = 8,410
On Digital Computers (Cont’d)
4
A method known as the doubling procedure is as follows. Given a
decimal number N, it can be decomposed as:
N = 2Q1 + R1
Q1 = 2Q2 + R2
.
.
.
Qk = 0 + Rk+1
(Q1 = N/2 - remainder)
(Q2 = Q1/2 - remainder)
.
.
.
etc.
The corresponding binary number is obtained by writing the
remainders Rk+1, Rk, ... , R1 in the reverse order as:
B = Rk+1RkRk-1 ... R1
Example
5
Convert the decimal number N = 8,410, to a binary number.
Solution:
Perform sequential division by 2 as follows:
8,410 = (24,205) + 0
65 = (232) + 1
4,205 = (22,102) + 1
32 = (216) + 0
2,102 = (21,051) + 0
16 = (28) + 0
1,051 = (2525) + 1
8 = (24) + 0
525 = (2262) + 1
4 = (22) + 0
262 = (2131) + 0
2 = (21) + 0
131 = (265) + 1
1 = (20) + 1
The binary equivalent of 8,410 is then given by collecting the remainder
digits from the last to the first:
10000011011010 = 11213 + 0212 + 0211 + 0210 + 029 + 028 + 127 + 126
+ 025 + 124 + 123 + 022 + 121 + 020
Representations of Numbers
6
Numbers are usually represented using the
normal form notation. That is,
x = m.10E for
10-1 < m < 1
where for x  0, m is called the mantissa and E
is the exponent. By convention, the number
zero has the normal notation, 0.100.
Significant Digits
7
If a number is written in standard decimal,
floating-point form, or in normal form such that:
x = 0.d1 d2 d3 ... dk10n
with d1  0 and dk  0, we say that this number has
k significant digits (or significant figures)
which indicates those digits that can be used with a
confidence relative to the true value of the number.
Significant Digits (Cont’d)
8
Note that the zeros which are used only to shift the decimal point are
not counted as significant figures. The leading zeros may or may not be
significant. For example,
x = 0.0002815 has 4 significant figures!
x = 1,200 may have 4 significant figures!
Some examples are:
46.45072800
= 0.46450728102
(with 8 significant digits)
-335.12 = -0.33512103 (with 5 significant digits)
0.00517
= 0.51710-3
(with 3 significant digits)
0.74
= 0.74100
(with 2 significant digits)
Computer Representation of Numbers
The decimal equivalent of the binary number represented in Figure
1 is given by:
-(026 + 025 + 024 + 123 + 022 + 121 + 120)
= -(0 + 0 + 0 + 8 + 0 + 2 + 1)
= -11
{sign}

1
0

Value
0
0
1
0
1
1
Figure 1 Binary representation of an integer using an
8 bit word (or Byte)
9
Example
10
Determine the largest integer that can be represented by an 8 bit
machine.
Solution:
Imax = +(126 + 125 + 124 + 123 + 122 + 121 + 120)
= +( 64 + 32 + 16 + 8 + 4 + 2 + 1 )
= +(127)
= +(27 - 1)
In general:
Imax = +[2(n -1) - 1]; Imin = -[2(n -1) - 1]
For a binary computer utilizing 32 bit words,
Imax = 2,147,483,647
Floating-Point Representation
A floating-point number is written as:
x = (sign)m.b(sign)E
where m is the mantissa, b is the base (b = 2 for a binary
system), and E is the exponent.
Sign of Mantissa
d1
Digits of Mantissa
d2
d3
d4
Sign of Exponent Digits of Exponent
d5
d6
d7
d8
11
Example
Determine the smallest, positive, nonzero, floating point
number that can be represented by an eight bit machine
using binary system with one bit spared for the sign of
the mantissa, one bit for the sign of the exponent, and
two bits for the digits of the exponent:
Sign of Mantissa
0
Digits of Mantissa
0
0
0
Sign of Exponent Digits of Exponent
1
1
1
1
Solution:
m = +(023 + 022 + 021 + 120)
m = +( 0
+0 + 0 + 1 )=1
E = -[(121) + (120)] = -(2+1) = - 3
Number = 12-3 (which is equal to 0.1250 in decimal system)
12
Decimal Numeral System
 Base 10 positional notation
 1010 = 1*103 + 0*102 + 1*101 + 0*100
= 1*1000+ 0*100 + 1*10 + 0*1
= 1010
 Number set : (0, 1, 2, …, 8, 9)
 Operations: addition, multiplication, etc.
 Numbers of same value are longer than Hex but
shorter than Bin
 Not so easy to convert into Bin or Hex
Binary Numeral System
 Base 2 positional notation
 1010 (B) = 1*23 + 0*22 + 1*21 + 0*20
= 1*8 + 0*4 + 1*2 + 0*1
= 10 (in decimal)
 Number set : (0 & 1)
 Operations: addition, multiplication, etc.
 Addition: 1001 + 1100 = 10101
 Good for computer systems – logical gates with only two
different values or states; Can be easily converted into Hex
(4 Bin bits 1 Hex bit)
Hexadecimal Numeral System
 Base 16 positional notation
 1010 (H) = 1*163 + 0*162 + 1*161 + 0*160
= 1 *4096 + 0* 256 + 1* 16 + 0 * 1
= 4112 (in decimal)
 Number set : (0 ~ 9, A, B, C, D, E, F)
 Operations: addition, multiplication, etc.
 Numbers of same value are shorter (vs. binary and
decimal)
 Can be easily converted into Binary (1 Hex bit  4
Bin bits)
Binary  HexadecimalDecimal