Chapter 3 Section 1 Number Representation Modern cryptographic methods, unlike the classical methods we just learned, are computer based. Representation of Numbers – Ordinary numbers that we see each day are represented as base 10. The numbers are a sum of powers of 10. Example 1: Write as sum of powers of 10… Example 1
Representation of Numbers Binary Numbers – Binary Numbers are base 2 numbers. They are represented by just two digits: 0, and 1. Examples of binary numbers Examples – Definition of a binary numberbinary number – Example 2: Find decimal equivalent of the binary number 100. Example 2 – Example 3: Find decimal equivalent of the binary number Example 3 – Example 4: Find the decimal equivalent of the binary number … Example 4
Representation of Numbers To convert a decimal (base 10) number to binary, we divide the number by 2, getting a quotient and remainder. This process repeats itself until the quotient is zero. Reading the resulting remainders from last to the first gives the binary representation of the number. – Example 5: Convert 77 to binary Example 5 – Example 6: Convert 320 to binary Example 6 – Example 7: Convert 687 to binary… Example 7
Approximating the Size of Binary Numbers Many times the strength of a cryptographic method is expressed in terms of the size of a particular parameter. – Many times this parameter is expressed by the number of binary digits the number has. – Base 10 Number Size Binary Bound EstimateBinary Bound Estimate – Example 8: 32 bit number bound estimate Example 8 – Definition: Given a real number x, we say that ceil(x) is the smallest integer greater than x. Example: ceil(29.6) = 30. – Estimate of the number of binary digits required to express a base 10 decimal number. Estimate of the number – Example 9: Approximate how many binary digits are used to represent the number … Example 9
Conversion to Numbers Involving Other Bases Definition: A number of any given base. Definition Example 10: Convert the numeral 5476 from base 8 to base 10. Example 10 For bases that are larger than 10 we need additional digits. We use letters for these digits: A, B, C, D, etc. Digits For Base 12 & 16 Digits Example 11: Convert EA3 base 16 to base 10… Example 11
Converting From Base 10 Numbers to an Arbitrary Base To convert a decimal (base 10) number to an arbitrary base a, we divide the number by a, getting a quotient and remainder. The quotient is then divided by a, obtaining a new quotient and remainder. This process repeats itself until the quotient is zero. Reading the resulting remainders from the last to the first gives the base a representation of the number. Example 12: Convert 689 to base 5. Example 12 Example 13: Convert to Hexadecimal… Example 13
Converting From Binary to Hexadecimal The Binary to Hexadecimal Table.Binary to Hexadecimal – Write the binary number in blocks of 4 digits. If there are not enough fill in on the left with 0’s. – Using the table, convert each four digit binary block to its hexadecimal equivalent. – Example 14: Convert to hexadecimal. Example 14 – Example 15: Convert to hexadecimal. Example 15 – Example 16: Convert A61F0 to binary. Example 16 – Example 17: Convert 72E1C5 to binary… Example 17
Binary XOR Operation The binary XOR operation has the following properties:XOR – If two things are true (value of 1) then the result of the xor operation is false (value of 0). – If two things are false (value of 0) then the result of the xor operation is false – If exactly one of the two is true, and therefore the other is false, then the result of the xor operation is true. – Example 18: Compute xor of two numbers Example 18 – Example 19: Compute xor of two numbers … Example 19
ASCII Codes for Characters So far we have used MOD 26 alphabet assignment table to assign numerical values to each letter. Computers normally use the ASCII (American Standard Code for Information Interchange) for obtaining numerical representation of characters. Example 20: Find numerical ASCII representation. Example 20 Example 21: Decode ASCII number message…! Example 21