Modulo Arithmetic & Text Coding ECE Slides-03a John Copeland

Slides:



Advertisements
Similar presentations
Introduction So far, we have studied the basic skills of designing combinational and sequential logic using schematic and Verilog-HDL Now, we are going.
Advertisements

EET 1131 Unit 7 Arithmetic Operations and Circuits
HEXADECIMAL NUMBERS Code
Registers and Ranges. Register – Compared to a Calculator If there are only 9 digits available on display how long can the number displayed be? ANS: 9.

VIT UNIVERSITY1 ECE 103 DIGITAL LOGIC DESIGN CHAPTER I NUMBER SYSTEMS AND CODES Reference: M. Morris Mano & Michael D. Ciletti, "Digital Design", Fourth.
Computer Arithmetic: Binary, Octal and Hexadecimal Presented by Frank H. Osborne, Ph. D. © 2005 ID 2950 Technology and the Young Child.
Binary Conversion In today’s lesson we will link together the binary and algorithm topics by looking at how to get the computer to: convert binary to decimal.
9/15/09 - L3 CodesCopyright Joanne DeGroat, ECE, OSU1 Codes.
Binary Addition Addition Rules: = = = = = carry 1 1 carry 1 Example 1: Example 2:
LING 408/508: Programming for Linguists Lecture 2 August 28 th.
Use effective written methods to add whole numbers.
Georgia Institute of Technology Introduction to Java, and DrJava Barb Ericson Georgia Institute of Technology Aug 2005.
Binary Arithmetic & Data representation
Lec 3: Data Representation Computer Organization & Assembly Language Programming.
N, Z, C, V in CPSR with Adder & Subtractor Prof. Taeweon Suh Computer Science Education Korea University.
How computers calculate How binary operations yield complex capabilities.
Number Systems Denary Base 10 Binary Base 2 Hexadecimal Base 16
Binary Arithmetic for DNA Computers R. Barua and J. Misra Preliminary Proceedings of the Eighth International Meeting on DNA Based Computers, pp ,
Coding and Formatting Data for Network Use Syntax – Format (2-bytes for port number) Semantics – Meaning of Allowed Content (binary 16-bit number, Port.
All even numbers are divisible by 2 Even numbers are numbers that end with either 0, 2, 4, 6, or 8.
Lattice Multiplication. Step 1 1)Draw a set of 2 by 2 boxes. 46 x 79 2) Cut the boxes in half diagonally. 3) Place the numbers on the outside of the boxes.
NXT File System Just like we’re able to store multiple programs and sound files to the NXT, we can store text files that contain information we specify.
Rabin & Karp Algorithm. Rabin-Karp – the idea Compare a string's hash values, rather than the strings themselves. For efficiency, the hash value of the.
Carnegie Mellon 1 Saint Louis University Data Representation in Memory CSCI 2400 / ECE 3217: Computer Architecture Instructor: David Ferry Slides adapted.
CHAPTER 5: Representing Numerical Data
Data Representation COE 308 Computer Architecture
Number Systems.
Dr. Clincy Professor of CS
Data Representation ICS 233
Lec 3: Data Representation
Data Representation.
CS1010 Programming Methodology
SE-1021 Software Engineering II
2 Digit by 2 Digit Multiplication
…to GCSE Level with Python Sue Sentance
CHAPTER 4: Representing Integer Data
Number Systems.
Data Representation COE 301 Computer Organization
LING 388: Computers and Language
W Customize this banner with your own message! Select the letter and add your own text. Use one character per slide.
LING 408/508: Computational Techniques for Linguists
Introduction to Java, and DrJava part 1
Learning Outcomes –Lesson 4
B Customize this banner with your own message! Select the letter and add your own text. Use one character per slide.
H Customize this banner with your own message! Select the letter and add your own text. Use one character per slide.
B Customize this banner with your own message! Select the letter and add your own text. Use one character per slide.
ECB2212-Digital Electronics Codes
W Customize this banner with your own message! Select the letter and add your own text. Use one character per slide.
Storing Negative Integers
Homework Homework Continue Reading K&R Chapter 2 Questions?
Introduction to Java, and DrJava
H Customize this banner with your own message! Select the letter and add your own text. Use one character per slide.
W Customize this banner with your own message! Select the letter and add your own text. Use one character per slide.
Data Representation ICS 233
Comp Org & Assembly Lang
C Customize this banner with your own message! Select the letter and add your own text. Use one character per slide.
W Customize this banner with your own message! Select the letter and add your own text. Use one character per slide.
LING 388: Computers and Language
Starter: There are 25 prime numbers under 100.
Introduction to Java, and DrJava
Introduction to Java, and DrJava part 1
Information Representation
2's Complement Arithmetic
W Customize this banner with your own message! Select the letter and add your own text. Use one character per slide.
Lattice Multiplication
W Customize this banner with your own message! Select the letter and add your own text. Use one character per slide.
Data Representation COE 308 Computer Architecture
Chapter 5: Hashing Hash Tables
H Customize this banner with your own message! Select the letter and add your own text. Use one character per slide.
Presentation transcript:

Modulo Arithmetic & Text Coding ECE6612 - Slides-03a John Copeland Georgia Tech 1-24-14

= 1001110000101111 Cryptographic Operations make use of : XOR (faster than add - no “carry” operations) and (A + B) + B = A if A + B = C then A = B + C Modulo (%) 2n arithmetic: 1011001010010011001110000101111 % 216 = 1001110000101111 Still to handle 256-bit numbers on a 32-bit Computer requires representing the number as an array: N = N[0] + N[1]*232 + N[2]*264 + … + N[7]*2224 2

To multiple two 256-bit numbers modulo(2256), X = M * N % 2256 where int64 N[8], M[8], X[8] N = N[0] + N[1]*232 + N[2]*264 + … + N[7]*2224 M = M[0] + M[1]*232 + M[2]*264 + … + M[7]*2224 X = N[0]*M[0] + (N[0]*M[1] + N[1]*M[0])*232 + … X[n] = ∑(i=0 to n) ∑(j=0 to [n-j]) N[i]*M[j] as array Carries must then be processed: X[i] = X[i] + (X[i-1] >> 32) ; X[i-1] &= 0xffffffff Note that half the terms are not needed: those with i+j >7 because of the modulo(2256) 3

Compute the following: (A * B * C) % 10 A = 15897229742 Answer: A * B * C % 10 = ( A %10 ) * ( B %10 ) * ( C %10 ) = (2 * 8 * 3) %10 = ( 48 ) %10 = 8 The modulo operation can be done on any intermediate values that exceed the modulus, for addition or multiplication. 4

Note that 9, 99, 999, 999…999 - all modulo 9 = 0, therefore: Just for fun, ,without using a calculator, or pen and paper, compute the following: (A * B * C) % 9 A = 15897229742 B = 89685245788 C = 78597945993 Answer: Note that 9, 99, 999, 999…999 - all modulo 9 = 0, therefore: 1, 10, 100, 1000 1000…000 - all modulo 9 = 1 (each is 1 + integer * 9) A %9 = 1+5+8+9+7+2+2+9+7+4+2 %9 add up the digits 1+5+8+6 = 11%9 = 1+1 = 2 etc. So, (A * B * C) % 9 = (2 * 7 * 3) %9 = 14 %9 * 3 = 15 %9 = 6 Also (A + B + C) %9 = (2 + 7 + 3) %9 = 3 The “method of nines” can check addition and multiplication. 5

If X %m = x then X = integerX * m + x (0<= x <m) The modulo operation can be done on any intermediate values that exceed the modulus, for addition or multiplication. Why does this work? If X %m = x then X = integerX * m + x (0<= x <m) (X + Y) %m = {(integerX + integerY) *m + (x + y)} %m (X + Y) %m = (x + y) %m (X * Y) %m = {(integerX * integerY) *m2 )} %m + + {(integerX *y *m)} %m + {(integerY *x *m)} %m + (x * y) %m (X * Y) %m = (x * y) %m 6

End-Line(s) UTF-8 Since 2007 Teletype, MSDOS, Internet: LF and CR ---------------------- Teletype, MSDOS, Internet: LF and CR UNIX: LF (^J, 0x0A) Mac OS Before OS X CR (^M ,0x0D) After OSX Either CR or LF HTML ...<br> or <p>...</p> UTF-8 Since 2007 To type control characters. hold down Control Key and type the letter in 3rd column. ( LF is typed as Control+J written as ^J ) 7