# 1. Define: (a) Variable, (b) Constant, (c) Type, (d) Enumerated Type, (e) Identifier.

Save this PDF as:

Size: px
Start display at page:

Download "1. Define: (a) Variable, (b) Constant, (c) Type, (d) Enumerated Type, (e) Identifier."

## Transcription

1 Study Group 1 Variables and Types 1. Define: (a) Variable, (b) Constant, (c) Type, (d) Enumerated Type, (e) Identifier. 2. What does the byte represent? 3. What is the purpose of the declarations section of a Pascal program? Why are there so many different types of whole number? 4. Write Pascal statements that compute the roots of a quadratic equation ax 2 + bx + c = The function Ord can be applied to any ordinal type, including enumerated types. In particular, for working with ASCII characters (type Char): Ord(ch) computes the ASCII value (ordinal position) of character ch Chr(n) computes the character whose ASCII value is n; Thus Ord( A ) = 65, Ord( a ) = 97, Chr(122) = z, Chr(90) = Z, etc. The inbuilt type string is made of up of the sequence characters, numbered from 1. The [] notation is used to refer to a character at a particular position in a string. So for the string S = LIAM, S[1] = L, S[2] = I, etc. The function LENGTH can be applied to a variable type of string to return the number of characters making up that string, thus LENGTH( LIAM ) = 4. The lucky number for a name is made by adding the values of the letters, then repeating until the value is less than 10. So: LIAM = = 35 = 8 Write formal statements (which could be Pascal) that compute the lucky number for (a) Liam, (b) your name. 6. Write Pascal statements that change the string SEAL into the string COAT by changing one letter at a time, each time making a new (proper) word. 7. Define an enumerated type for the days of the week. Consider some useful functions on this type (e.g. before, after, weekend, weekday, n days time, etc), how they might be programmed, and what their type signature would be. 8. In The Republic, Plato introduces his Theory of Forms, using as an example distinction between 2 as a real number (used by practical people for counting) and the number 2 of pure mathematics. Point out to Plato where he was going wrong. The, 2001.

2 Study Group 2 Loops and Conditionals A cipher is a general term for any cryptographic technique in which the letters of a string, called the plaintext, are changed into another string, called the ciphertext. A transposition cipher is a cipher where the characters stay the same but change position in the string; a substitution cipher is a cipher where the characters change but retain the same relative positions. The double rail transposition cipher mixes alternative characters: e.g. hello world = h e l l o w o r l d = hloolelwrd One possible substitution cipher is to exchange each letter n places from the start of the alphabet with a letter n places from the end of the alphabet, e.g. substitute z for a, y for b, and so on. 1. Write a program to encode and decode a plaintext using the double rail cipher described above. 2. Write a program to encode and decode a plaintext using the substitution cipher described above. 3. Generalise the program of Question 1 for an arbitrary number of rails. 4. Write a program to encode and decode a plaintext using a transposition cipher which swaps adjacent letter pairs. 5. The Caesar Shift Cipher. Write a program to encode and decode a plaintext using a substitution cipher in which the letters of the alphabet are shifted n places, i.e. for n =1, a b, b c, etc.; for n =2,, a c, b d, etc. The, 2001.

3 Study Group 3 Algorithm Design Using the Vignere Cipher, a keyword is used to index into a set of Caesar Shift Ciphers, each shifted by a different number of places: A B C D E F a b c d e f g h i j k l m n o p q r s t u v w x y z 1 b c d e f g h i j k l m n o p q r s t u v w x y z a 2 c d e f g h i j k l m n o p q r s t u v w x y z a b 3 d e f g h i j k l m n o p q r s t u v w x y z a b c 4 e f g h i j k l m n o p q r s t u v w x y z a b c d 5 f g h i j k l m n o p q r s t u v w x y z a b c d e 6 g h i j k l m n o p q r s t u v w x y z a b c d e f So using the keyword DAB (row 4, row 1, row 2), a plaintext would be enciphered by repeating the keyword over the plaintext and looking at the row of the table to encode each letter: Keyword Plaintext Ciphertext D A B D A B D A B D A B D A B D A B h e e d t h e i d e s o f m a r c h l f g h u j i j f i t q j n c v d j Note how the same letters in the plaintext can be encoded as different letters in the ciphertext, and how different letters in the plaintext are encoded as the same letter in the ciphertext. 1. Design a program (i.e. specify an algorithm in pseudo-code) to encode and decode a plaintext using the Vignere Cipher. 2. Implement your design, by writing a program to encode and decode a plaintext using the Vignere Cipher. Hint. Use a string constant to represent the Vignere Table and use modulo arithmetic. The, 2001.

4 Study Group 4 Procedures and Functions 1. Write a function that computes the greatest common divisor (GCD) of two numbers. 2. Write a function that computes whether or not two numbers are co-prime (relatively prime), i.e. their GCD is Write a procedure that gets as user input two numbers, p and q, checks that they are both prime, computes N = p*q, M = (p-1)*(q-1), and asks for another number e which must be less than p*q, checks that M and e are co-prime, and returns the values of M, N, and e. 4. Write a function that computes the value of d in the equation e * d MOD M = 1 Hint. One way is to test successive numbers of d. Another way is to recognize that trying to calculate d in d * e MOD M = 1 is the same as computing d such that (de - 1) is evenly divisible by (p-1)(q-1), i.e. M. Mathematicians write this as de = 1 (mod (p-1)(q-1)), and they call d the multiplicative inverse of e. This is easy to do - simply find an integer x which causes d = (x(p-1)(q-1) + 1)/e to be an integer, then use that value of d. Then we are trying to calculate: d = xm + 1/e de = xm + 1 de xm = 1 de + (-x)m = 1 There is an algorithm called Extended Euclid s algorithm which can be used to compute the greatest common divisor, g, of two positive integers, a and b, and coefficients, h and j, such that g = ha + jb. 5. Write a function that will compute modulos of very big exponentials, bearing in mind the following example: A e mod N =(A e1 * A e2 ) mod N where e = e1 + e2, and if e is a power of 2, and: A e mod N = (A 2 ) e/2 mod N = (A 2 mod N) e/2 mod N The, 2001.

5 Study Group 4a Procedures and Functions 1. Write a function maxof2 that returns the larger of two values. Write another function minof2 that returns the smaller of two values. Write a function maxof3 that returns the largest of three values, and another function minof3 that returns the smallest of 3 values. Write a function midof3 that returns the middle value of three numbers, using one statement, using maxof2 and minof2 functions only. 2. Write a function which takes as input a number in the range and which returns a date in DD/MM format. In the first version, ignore leap years. Write a second version which takes as an extra parameter the year, and returns the date in DD/MM/YY format. In other words, you will need to write a (Boolean) function leapyear, according to the rules: 1. If a year is divisible by 4 it is a leap year; 2. Unless it is divisible by 100, in which case it is not a leap year; 3. Unless it is divisible by 400, in which case it is still a leap year. This means that 1800 and 1900 were not leap years, but 2000 was. 3. Define a type which stores the vertices of a quadrilateral. Write a function which checks if the four vertices form a square. 4. Write procedures which draw right-angle triangles using characters, of a specified size and shape. The shape depends on which corner the right angle is in, and can be one of four possibilities: south-west, south east, north-west or north-east * * ***** ***** ** ** **** **** *** *** *** *** **** **** ** ** ***** ***** * * south-west south east north-west north-east The, 2001.

6 Study Group 5 Data Structures 1. Redesign the Vignere Cipher program using an array. Write a program to implement the redesign. 2. One way to crack a substitution cipher is frequency analysis. That is, the codebreaker looks for the most common letters occurring in the ciphertext, and supposes that these are the ciphers for the most commonly occurring letters in natural text. Write a program that counts the number of occurrences of each letter in a ciphertext. 3. Write a program that displays a graph of the results from Question Design a program that would propose solutions to a Caesar Shift Cipher. The, 2001.

7 Study Group 6 Dataflow Design The ADFGVX Cipher features both transposition and substitution. The process is: Draw up a 6-by-6 grid, filling the 36 squares at random with the 26 letters of the alphabet and the 10 digits. Each row and column of the grid is identified by a letter from A, D, F, G, V and X. The first stage of encryption is to take each letter of the plaintext, locate it in the grid, and substitute it with the letters labeling its row and column. The second stage is to use a keyword, the letters of which are written on the top of a fresh grid. The letters from the first stage are then written in rows across the grid. The grid itself is then rearranged so the letters of the keyword are in alphabetical order, then the letters are read off column by column. For example: given the grid: A D F G V X A z l x 6 f 9 D u 8 m g v e F 3 t h n d 2 G k i s c o y V j w b r 5 p X 4 a 0 1 q 7 hello world then codes as FF DX AD AD GV VD GV VG AD FV Assume we have the keyword LIAM. The code letters are then arranged and transposed L I A M A I L M F F D X D F F X A D A D A D A D G V V D V V G D G V V G V V G G A D F V F D A V Giving a final code of DAVVFFDVVDFAGGAXDDGV 1. Design (dataflow and pseudocode) a program to encode and decode using this cipher. 2 Write a program that implements the design. The, 2001.

8 Study Group 7 Noughts and Crosses Consider the design and pseudo-code from Lecture 9 (Tic Tac Toe). Then consider the following declarations: type var OandX = (nought, cross, blank) ; Tttboard1D = array [1..9] of OandX ; Tttboard2D = array [1..3,1..3] of OandX ; Frame1D : Tttboard1D ; Frame2D : Tttboard2D ; Player : OandX 1. Write code to initialize the frame at the start of a new game, using: (a) using a function; (b) using a procedure; (c) using a procedure with global variables. 2. Write a procedure that displays the state of the game at any point, for each of Frame1D and Frame2D. 3. Write a procedure or function that implements MakeTurn, i.e. inputs a board location from the user, validates it, and once valid input is entered, updates the game board. Specify whether you are using Tttboard1D or Tttboard2D and how the user enters input. 4. Write a procedure or function that calculates the game status from the current state of the board (GameOn, GameOver, GameWon, and GameDrawn). 5. Given a single additional data structure, it is possible to define a boolean function for checking GameWon using a single for loop whose body is a simple statement (a single assignment). Define this data structure and implement this function. 6. Define and implement a procedure that would allow the computer to make a turn. The, 2001.

9 Study Group 8 File Input and Output Processing TextFiles 1. Write a program that takes as input a textfile, codes it using some cipher algorithm, and outputs it as another textfile. 2. Write another program which decodes encrypted textfiles. 3. Write a program which extends the ADFGVX cipher program by reading in the grid and keyword from some configuration file. Processing Typed Binary Files A program is required to process football results and update a league table. The league consists of twenty teams. Each week a number of matches are played between the two teams. The results of the matches are of the form: Arsenal 5 Tottenham Hotspur 3 Newcastle United 0 West Ham United 2 Manchester United 4 Brentford 7 And so on. The league table will store, for each of twenty teams, the team name, the number of game played, the number of home matches won, drawn and lost, the number of away matches won, drawn, and lost, the goals scored for and against, and the total number of points (3 for each win, 1 for each draw and 0 for each loss). 4. Write declarations for: a date type of team records, a data type for a league table; a data type for results; a file of type results, and a file of type team records. 5. Design and implement a program which reads in a file of team records into a league table, then processes a file of results, updating the league table according to the results, then outputs the new league table to a new file. 6. Write out the new file sorted in order of points, then goal difference, then alphabetical order. ± 7 The, 2001.

10 Study Group 9 Abstract Data Types 1. A stack is a dynamic data structure providing a reserved amount of memory for storing data items. A stack can be used, for example, used for arithmetic calculations, or to keep track of internal operations. Stacks keep track of the sequence of routines called in a program. For example, if one routine calls another, which calls another and so on. As each routine is completed, the computer returns control to the calling routine all the way back to the first one that started the sequence. Stacks used in this way are LIFO based: the last item, or address, placed (pushed) onto the stack is the first item removed (popped) from the stack. Write a unit containing an abstract data type for a stack using an array. You should provide four access procedures: PUSH (push an item onto the stack), POP (remove the topmost item off the stack), PEEK (look at the top item on the stack without processing it), and SIZE (how big the stack is). You can use any kind of data item for the type of data stored on the stack. 2. Re-implement the stack ADT of Q1 using a dynamic data structure. [Requires Pointers.] 3. Write a unit containing an abstract data type for a queue. A queue is like a stack except it is LILO based (i.e. last in last out). Again, design and implement two implementations, one using an array and one using a dynamic data structure. The, 2001.

### Data Encryption A B C D E F G H I J K L M N O P Q R S T U V W X Y Z. we would encrypt the string IDESOFMARCH as follows:

Data Encryption Encryption refers to the coding of information in order to keep it secret. Encryption is accomplished by transforming the string of characters comprising the information to produce a new

### Number Theory. Proof. Suppose otherwise. Then there would be a finite number n of primes, which we may

Number Theory Divisibility and Primes Definition. If a and b are integers and there is some integer c such that a = b c, then we say that b divides a or is a factor or divisor of a and write b a. Definition

### Cryptography and Network Security Department of Computer Science and Engineering Indian Institute of Technology Kharagpur

Cryptography and Network Security Department of Computer Science and Engineering Indian Institute of Technology Kharagpur Module No. # 01 Lecture No. # 05 Classic Cryptosystems (Refer Slide Time: 00:42)

### 1) A very simple example of RSA encryption

Solved Examples 1) A very simple example of RSA encryption This is an extremely simple example using numbers you can work out on a pocket calculator (those of you over the age of 35 45 can probably even

### MLR Institute of Technology

MLR Institute of Technology DUNDIGAL 500 043, HYDERABAD COMPUTER SCIENCE AND ENGINEERING Computer Programming Lab List of Experiments S.No. Program Category List of Programs 1 Operators a) Write a C program

### MA2C03 Mathematics School of Mathematics, Trinity College Hilary Term 2016 Lecture 59 (April 1, 2016) David R. Wilkins

MA2C03 Mathematics School of Mathematics, Trinity College Hilary Term 2016 Lecture 59 (April 1, 2016) David R. Wilkins The RSA encryption scheme works as follows. In order to establish the necessary public

### HILL CIPHERS: A LINEAR ALGEBRA PROJECT WITH MATHEMATICA

HILL CIPHERS: A LINEAR ALGEBRA PROJECT WITH MATHEMATICA Murray Eisenberg University of Massachusetts Mathematics and Statistics Department Lederle Graduate Research Tower Amherst, MA 01003-4515 murray@math.umass.edu

### Mathematics of Cryptography Modular Arithmetic, Congruence, and Matrices. A Biswas, IT, BESU SHIBPUR

Mathematics of Cryptography Modular Arithmetic, Congruence, and Matrices A Biswas, IT, BESU SHIBPUR McGraw-Hill The McGraw-Hill Companies, Inc., 2000 Set of Integers The set of integers, denoted by Z,

### Notes for Recitation 5

6.042/18.062J Mathematics for Computer Science September 24, 2010 Tom Leighton and Marten van Dijk Notes for Recitation 5 1 Exponentiation and Modular Arithmetic Recall that RSA encryption and decryption

### Solutions to Problem Set 1

YALE UNIVERSITY DEPARTMENT OF COMPUTER SCIENCE CPSC 467b: Cryptography and Computer Security Handout #8 Zheng Ma February 21, 2005 Solutions to Problem Set 1 Problem 1: Cracking the Hill cipher Suppose

### Secret Writing. Introduction to Cryptography. Encryption. Decryption. Kerckhoffs s ( ) Principle. Security of Cryptographic System

Introduction to Cryptography ECEN 1200, Telecommunications 1 Secret Writing Cryptography is the science and study of secret writing. More specifically, cryptography is concerned with techniques for enciphering

### Cryptography. Helmer Aslaksen Department of Mathematics National University of Singapore

Cryptography Helmer Aslaksen Department of Mathematics National University of Singapore aslaksen@math.nus.edu.sg www.math.nus.edu.sg/aslaksen/sfm/ 1 Basic Concepts There are many situations in life where

### 3 Structure of Modular Multiplication

3 Structure of Modular Multiplication Unlike addition, multiplication in Z M is fairly strange. There may not always be an inverse, you can multiply two non-zero numbers together and get zero, and in general

### C programming: exercise sheet L2-STUE (2011-2012)

C programming: exercise sheet L2-STUE (2011-2012) Algorithms and Flowcharts Exercise 1: comparison Write the flowchart and associated algorithm that compare two numbers a and b. Exercise 2: 2 nd order

### Factoring Algorithms

Factoring Algorithms The p 1 Method and Quadratic Sieve November 17, 2008 () Factoring Algorithms November 17, 2008 1 / 12 Fermat s factoring method Fermat made the observation that if n has two factors

### The Laws of Cryptography Cryptographers Favorite Algorithms

2 The Laws of Cryptography Cryptographers Favorite Algorithms 2.1 The Extended Euclidean Algorithm. The previous section introduced the field known as the integers mod p, denoted or. Most of the field

### Mathematics of Cryptography

CHAPTER 2 Mathematics of Cryptography Part I: Modular Arithmetic, Congruence, and Matrices Objectives This chapter is intended to prepare the reader for the next few chapters in cryptography. The chapter

### Cyber Security Workshop Encryption Reference Manual

Cyber Security Workshop Encryption Reference Manual May 2015 Basic Concepts in Encoding and Encryption Binary Encoding Examples Encryption Cipher Examples 1 P a g e Encoding Concepts Binary Encoding Basics

### Overview/Questions. What is Cryptography? The Caesar Shift Cipher. CS101 Lecture 21: Overview of Cryptography

CS101 Lecture 21: Overview of Cryptography Codes and Ciphers Overview/Questions What is cryptography? What are the challenges of data encryption? What factors make an encryption strategy successful? What

### Shared Secret = Trust

Trust The fabric of life! Holds civilizations together Develops by a natural process Advancement of technology results in faster evolution of societies Weakening the natural bonds of trust From time to

### Mathematics of Cryptography Part I

CHAPTER 2 Mathematics of Cryptography Part I (Solution to Odd-Numbered Problems) Review Questions 1. The set of integers is Z. It contains all integral numbers from negative infinity to positive infinity.

### Mathematics of Cryptography

Number Theory Modular Arithmetic: Two numbers equivalent mod n if their difference is multiple of n example: 7 and 10 are equivalent mod 3 but not mod 4 7 mod 3 10 mod 3 = 1; 7 mod 4 = 3, 10 mod 4 = 2.

MODULAR ARITHMETIC KEITH CONRAD. Introduction We will define the notion of congruent integers (with respect to a modulus) and develop some basic ideas of modular arithmetic. Applications of modular arithmetic

### Data Structure. Lecture 3

Data Structure Lecture 3 Data Structure Formally define Data structure as: DS describes not only set of objects but the ways they are related, the set of operations which may be applied to the elements

### Topic 1: Cryptography

1 Introduction to Cryptography: 1.1 Science SCIE1000 Project, Semester 1 2011 Topic 1: Cryptography Cryptography is the science of using mathematics to hide information. Cryptography allows us to store

### Practice Problems for First Test

Mathematicians have tried in vain to this day to discover some order in the sequence of prime numbers, and we have reason to believe that it is a mystery into which the human mind will never penetrate.-

### The Euclidean algorithm for integers leads to the notion of congruence of two integers modulo a given integer.

Integers Modulo m The Euclidean algorithm for integers leads to the notion of congruence of two integers modulo a given integer. Congruence Modulo m Two integers a and b are congruent modulo m if and only

### Introduction to Modular Arithmetic, the rings Z 6 and Z 7

Introduction to Modular Arithmetic, the rings Z 6 and Z 7 The main objective of this discussion is to learn modular arithmetic. We do this by building two systems using modular arithmetic and then by solving

### Lecture 13 - Basic Number Theory.

Lecture 13 - Basic Number Theory. Boaz Barak March 22, 2010 Divisibility and primes Unless mentioned otherwise throughout this lecture all numbers are non-negative integers. We say that A divides B, denoted

### 8 Primes and Modular Arithmetic

8 Primes and Modular Arithmetic 8.1 Primes and Factors Over two millennia ago already, people all over the world were considering the properties of numbers. One of the simplest concepts is prime numbers.

### uses same key for encryption, decryption classical, conventional, single-key encryption

CEN 448 Security and Internet Protocols Chapter 2 Classical Encryption Techniques Dr. Mostafa Hassan Dahshan Computer Engineering Department College of Computer and Information Sciences King Saud University

### Hill s Cipher: Linear Algebra in Cryptography

Ryan Doyle Hill s Cipher: Linear Algebra in Cryptography Introduction: Since the beginning of written language, humans have wanted to share information secretly. The information could be orders from a

### Dr. Jinyuan (Stella) Sun Dept. of Electrical Engineering and Computer Science University of Tennessee Fall 2010

CS 494/594 Computer and Network Security Dr. Jinyuan (Stella) Sun Dept. of Electrical Engineering and Computer Science University of Tennessee Fall 2010 1 Introduction to Cryptography What is cryptography?

### 9 Modular Exponentiation and Cryptography

9 Modular Exponentiation and Cryptography 9.1 Modular Exponentiation Modular arithmetic is used in cryptography. In particular, modular exponentiation is the cornerstone of what is called the RSA system.

### Theory of Computation Prof. Kamala Krithivasan Department of Computer Science and Engineering Indian Institute of Technology, Madras

Theory of Computation Prof. Kamala Krithivasan Department of Computer Science and Engineering Indian Institute of Technology, Madras Lecture No. # 31 Recursive Sets, Recursively Innumerable Sets, Encoding

### Math 139 Problem Set #6 Solution 15 April 2003

Math 139 Problem Set #6 Solution 15 April 2003 A1 (Based on Barr, 41, exercise 3) (a) Let n be an integer greater than 2 Consider the list of numbers n! + 2, n! + 3, n! + 4,, n! + n Explain why all the

### Cryptography Exercises

Cryptography Exercises 1 Contents 1 source coding 3 2 Caesar Cipher 4 3 Ciphertext-only Attack 5 4 Classification of Cryptosystems-Network Nodes 6 5 Properties of modulo Operation 10 6 Vernam Cipher 11

### The Advantage Testing Foundation Solutions

The Advantage Testing Foundation 013 Problem 1 The figure below shows two equilateral triangles each with area 1. The intersection of the two triangles is a regular hexagon. What is the area of the union

### VALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANKULATHUR 603 203 DEPARTMENT OF COMPUTER APPLICATIONS QUESTION BANK IN REVISED BLOOM S TAXONOMY

ACADEMIC YEAR: 0 7 VALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANKULATHUR 0 0 SEMESTER: ODD BRANCH: MCA YEAR: I SEMESTER: I SUBJECT CODE AND NAME: MC70 Problem Solving and Programming NAME OF THE FACULTY

### Network Security. Security Attacks. Normal flow: Interruption: 孫 宏 民 hmsun@cs.nthu.edu.tw Phone: 03-5742968 國 立 清 華 大 學 資 訊 工 程 系 資 訊 安 全 實 驗 室

Network Security 孫 宏 民 hmsun@cs.nthu.edu.tw Phone: 03-5742968 國 立 清 華 大 學 資 訊 工 程 系 資 訊 安 全 實 驗 室 Security Attacks Normal flow: sender receiver Interruption: Information source Information destination

### add, push get, contains, put remove, pop ! Want O(1) operations but with general " E.g., look up employee records by social security #

Collection implementations Lecture 9: Hash tables Unsorted sets & maps Resizable arrays (array) Sorted sets Sorted maps (search tree) Stacks Queues (array) Priority queues (tree, heap) add, push O(1) O(lg

### Introduction to Finite Systems: Z 6 and Z 7

Introduction to : Z 6 and Z 7 The main objective of this discussion is to learn more about solving linear and quadratic equations. The reader is no doubt familiar with techniques for solving these equations

### 159.334 Computer Networks. Network Security 1. Professor Richard Harris School of Engineering and Advanced Technology

Network Security 1 Professor Richard Harris School of Engineering and Advanced Technology Presentation Outline Overview of Identification and Authentication The importance of identification and Authentication

### 6.096 Lab 1. Due: 7 January 12:30:00. September 20, 2011

6.096 Lab 1 Due: 7 January 1:30:00 September 0, 011 1 Additional Material 1.1 Constants A constant is an expressions with a fixed value. Kinds of constants: Literals: used to express particular values

### 12 Abstract Data Types

12 Abstract Data Types 12.1 Source: Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: Define the concept of an abstract data type (ADT).

### Section 2.1: Shift Ciphers and Modular Arithmetic

1 Section 2.1: Shift Ciphers and Modular Arithmetic Practice HW from Barr Textbook (not to hand in) p.66 # 1, 2, 3-6, 9-12, 13, 15 The purpose of this section is to learn about modular arithmetic, which

### Number Theory and Cryptography using PARI/GP

Number Theory and Cryptography using Minh Van Nguyen nguyenminh2@gmail.com 25 November 2008 This article uses to study elementary number theory and the RSA public key cryptosystem. Various commands will

Hill Cipher Project K80TTQ1EP-??,VO.L,XU0H5BY,_71ZVPKOE678_X,N2Y-8HI4VS,,6Z28DDW5N7ADY013 Directions: Answer all numbered questions completely. Show non-trivial work in the space provided. Non-computational

### Assembly language programs are made up of statements. Each statement may be composed of constants, literals, names, mnemonics, operands, and comments.

CS221 Assembly Language Fundamentals : Irvine Chapter 3 While debug is good for writing very small programs and experimenting with memory, interrupts, and function calls, it is not very good for larger

### CISC 310 ONLINE Spring 2016. Review for Final Exam

CISC 310 ONLINE Spring 2016 Review for Final Exam The following is a study guide to help you prepare for the exam. The exam will include but not be limited to the information on this review sheet. The

### Multiplicative Ciphers. Cryptography of Multiplicative Ciphers

Fall 2006 Chris Christensen MAT/CSC 483 Multiplicative Ciphers It is evident from the relative ease with which the Caesar Cipher or its generalization to an arbitrary number of positions of shift has been

### U.C. Berkeley CS276: Cryptography Handout 0.1 Luca Trevisan January, 2009. Notes on Algebra

U.C. Berkeley CS276: Cryptography Handout 0.1 Luca Trevisan January, 2009 Notes on Algebra These notes contain as little theory as possible, and most results are stated without proof. Any introductory

### = 2 + 1 2 2 = 3 4, Now assume that P (k) is true for some fixed k 2. This means that

Instructions. Answer each of the questions on your own paper, and be sure to show your work so that partial credit can be adequately assessed. Credit will not be given for answers (even correct ones) without

### POLYTECHNIC UNIVERSITY Department of Computer and Information Science. The Hill Cipher. K. Ming Leung

POLYTECHNIC UNIVERSITY Department of Computer and Information Science The Hill Cipher K. Ming Leung Abstract: The Hill cipher in cryptography is used to illustrate the application of matrices defined over

### Basic Algorithms In Computer Algebra

Basic Algorithms In Computer Algebra Kaiserslautern SS 2011 Prof. Dr. Wolfram Decker 2. Mai 2011 References Cohen, H.: A Course in Computational Algebraic Number Theory. Springer, 1993. Cox, D.; Little,

Family Name:... First Name:... Section:... Advanced Cryptography Final Exam July 18 th, 2006 Start at 9:15, End at 12:00 This document consists of 12 pages. Instructions Electronic devices are not allowed.

### The largest has a 0 in the sign position and 0's in all other positions:

10.2 Sign Magnitude Representation Sign Magnitude is straight-forward method for representing both positive and negative integers. It uses the most significant digit of the digit string to indicate the

### DATA STRUCTURES USING C

DATA STRUCTURES USING C QUESTION BANK UNIT I 1. Define data. 2. Define Entity. 3. Define information. 4. Define Array. 5. Define data structure. 6. Give any two applications of data structures. 7. Give

### Cryptography and Network Security. Prof. D. Mukhopadhyay. Department of Computer Science and Engineering. Indian Institute of Technology, Kharagpur

Cryptography and Network Security Prof. D. Mukhopadhyay Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Module No. # 01 Lecture No. # 12 Block Cipher Standards

### Cryptography and Network Security Prof. D. Mukhopadhyay Department of Computer Science and Engineering Indian Institute of Technology, Karagpur

Cryptography and Network Security Prof. D. Mukhopadhyay Department of Computer Science and Engineering Indian Institute of Technology, Karagpur Lecture No. #06 Cryptanalysis of Classical Ciphers (Refer

### PROPERTIES OF ELLIPTIC CURVES AND THEIR USE IN FACTORING LARGE NUMBERS

PROPERTIES OF ELLIPTIC CURVES AND THEIR USE IN FACTORING LARGE NUMBERS A ver important set of curves which has received considerabl attention in recent ears in connection with the factoring of large numbers

### PRIME NUMBERS & SECRET MESSAGES

PRIME NUMBERS & SECRET MESSAGES I. RSA CODEBREAKER GAME This is a game with two players or teams. The players take turns selecting either prime or composite numbers as outlined on the board below. The

### Cryptography: RSA and the discrete logarithm problem

Cryptography: and the discrete logarithm problem R. Hayden Advanced Maths Lectures Department of Computing Imperial College London February 2010 Public key cryptography Assymmetric cryptography two keys:

### Introduction to Hill cipher

Introduction to Hill cipher We have explored three simple substitution ciphers that generated ciphertext C from plaintext p by means of an arithmetic operation modulo 26. Caesar cipher: The Caesar cipher

### 3. BINARY NUMBERS AND ARITHMETIC

3. BINARY NUMBERS AND ARITHMETIC 3.1. Binary Numbers The only place in a computer where you will find the number 9 is on the keyboard. Inside the computer you will only find 0 s and 1 s. All computer memory

### Today ENCRYPTION. Cryptography example. Basic principles of cryptography

Today ENCRYPTION The last class described a number of problems in ensuring your security and privacy when using a computer on-line. This lecture discusses one of the main technological solutions. The use

### CIS 6930 Emerging Topics in Network Security. Topic 2. Network Security Primitives

CIS 6930 Emerging Topics in Network Security Topic 2. Network Security Primitives 1 Outline Absolute basics Encryption/Decryption; Digital signatures; D-H key exchange; Hash functions; Application of hash

### 3. Applications of Number Theory

3. APPLICATIONS OF NUMBER THEORY 163 3. Applications of Number Theory 3.1. Representation of Integers. Theorem 3.1.1. Given an integer b > 1, every positive integer n can be expresses uniquely as n = a

### IMPERATIVE PROGRAMMING C LANGUAGE

J.NAWROCKI, M. ANTCZAK, H. ĆWIEK, W. FROHMBERG, A. HOFFA, M. KIERZYNKA, S. WĄSIK IMPERATIVE PROGRAMMING C LANGUAGE EX. 1. Write in C language programs described below, compile them and tentatively debug:

### Public Key Cryptography and RSA

Public Key Cryptography and RSA Raj Jain Washington University in Saint Louis Saint Louis, MO 63130 Jain@cse.wustl.edu Audio/Video recordings of this lecture are available at: http://www.cse.wustl.edu/~jain/cse571-11/

### Cryptography and Network Security

Cryptography and Network Security Xiang-Yang Li Introduction The art of war teaches us not on the likelihood of the enemy s not coming, but on our own readiness to receive him; not on the chance of his

### RSA Encryption. Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles October 10, 2003

RSA Encryption Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles October 10, 2003 1 Public Key Cryptography One of the biggest problems in cryptography is the distribution of keys.

### Continued Fractions and the Euclidean Algorithm

Continued Fractions and the Euclidean Algorithm Lecture notes prepared for MATH 326, Spring 997 Department of Mathematics and Statistics University at Albany William F Hammond Table of Contents Introduction

### Elementary Number Theory We begin with a bit of elementary number theory, which is concerned

CONSTRUCTION OF THE FINITE FIELDS Z p S. R. DOTY Elementary Number Theory We begin with a bit of elementary number theory, which is concerned solely with questions about the set of integers Z = {0, ±1,

### Kevin James. MTHSC 412 Section 2.4 Prime Factors and Greatest Comm

MTHSC 412 Section 2.4 Prime Factors and Greatest Common Divisor Greatest Common Divisor Definition Suppose that a, b Z. Then we say that d Z is a greatest common divisor (gcd) of a and b if the following

3. QUADRATIC CONGRUENCES 3.1. Quadratics Over a Finite Field We re all familiar with the quadratic equation in the context of real or complex numbers. The formula for the solutions to ax + bx + c = 0 (where

### Coach Monks s MathCounts Playbook! Secret facts that every Mathlete should know in order to win!

Coach Monks s MathCounts Playbook! Secret facts that every Mathlete should know in order to win! Learn the items marked with a first. Then once you have mastered them try to learn the other topics.. Squares

### Mathematical induction & Recursion

CS 441 Discrete Mathematics for CS Lecture 15 Mathematical induction & Recursion Milos Hauskrecht milos@cs.pitt.edu 5329 Sennott Square Proofs Basic proof methods: Direct, Indirect, Contradiction, By Cases,

### Pseudo code Tutorial and Exercises Teacher s Version

Pseudo code Tutorial and Exercises Teacher s Version Pseudo-code is an informal way to express the design of a computer program or an algorithm in 1.45. The aim is to get the idea quickly and also easy

### Chapter 3. if 2 a i then location: = i. Page 40

Chapter 3 1. Describe an algorithm that takes a list of n integers a 1,a 2,,a n and finds the number of integers each greater than five in the list. Ans: procedure greaterthanfive(a 1,,a n : integers)

### Integers and division

CS 441 Discrete Mathematics for CS Lecture 12 Integers and division Milos Hauskrecht milos@cs.pitt.edu 5329 Sennott Square Symmetric matrix Definition: A square matrix A is called symmetric if A = A T.

### Outline. Cryptography. Bret Benesh. Math 331

Outline 1 College of St. Benedict/St. John s University Department of Mathematics Math 331 2 3 The internet is a lawless place, and people have access to all sorts of information. What is keeping people

### Continued fractions and good approximations.

Continued fractions and good approximations We will study how to find good approximations for important real life constants A good approximation must be both accurate and easy to use For instance, our

### MINI LESSON. Lesson 5b Solving Quadratic Equations

MINI LESSON Lesson 5b Solving Quadratic Equations Lesson Objectives By the end of this lesson, you should be able to: 1. Determine the number and type of solutions to a QUADRATIC EQUATION by graphing 2.

### PROBLEMS (Cap. 4 - Istruzioni macchina)

98 CHAPTER 2 MACHINE INSTRUCTIONS AND PROGRAMS PROBLEMS (Cap. 4 - Istruzioni macchina) 2.1 Represent the decimal values 5, 2, 14, 10, 26, 19, 51, and 43, as signed, 7-bit numbers in the following binary

### GCSE 9-1 Mathematics Higher Tier Grade 9 Tough Paper Paper 1

GCSE 9-1 Mathematics Higher Tier Grade 9 Tough Paper Paper 1 Total marks 80 1 Hour 30 minutes PLEASE NOTE: This paper does not claim the questions included are Grade 9 questions. This paper was designed

### ML for the Working Programmer

ML for the Working Programmer 2nd edition Lawrence C. Paulson University of Cambridge CAMBRIDGE UNIVERSITY PRESS CONTENTS Preface to the Second Edition Preface xiii xv 1 Standard ML 1 Functional Programming

### [100/23] - The Ciphertext has 100 letters and 23 different letters are represented.

Chapter 10 ACA Jargon and Familiar Terms [100/23] - The Ciphertext has 100 letters and 23 different letters are represented. 13-letter sequences - Found in the even decimations of the original alphabet.

### Network Security. HIT Shimrit Tzur-David

Network Security HIT Shimrit Tzur-David 1 Goals: 2 Network Security Understand principles of network security: cryptography and its many uses beyond confidentiality authentication message integrity key

### Comp 245 Data Structures. Stacks

Comp 245 Data Structures Stacks What is a Stack? A LIFO (last in, first out) structure Access (storage or retrieval) may only take place at the TOP NO random access to other elements within the stack An

### Discrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 5

CS 70 Discrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 5 Modular Arithmetic One way to think of modular arithmetic is that it limits numbers to a predefined range {0,1,...,N

### CMPS 10 Winter Homework Assignment 3

CMPS 10 Winter 2011- Homework Assignment 3 Problems: Chapter 2 (p.76): 20, 21, 22 Chapter 3 (p.120): 3abc, 6, 17abc, 18, 19, 20, 21, 22 Chapter 2: 20. Design an algorithm that is given a positive integer

### Lecture 1: Elementary Number Theory

Lecture 1: Elementary Number Theory The integers are the simplest and most fundamental objects in discrete mathematics. All calculations by computers are based on the arithmetical operations with integers

### CD 1 Real Numbers, Variables, and Algebraic Expressions

CD 1 Real Numbers, Variables, and Algebraic Expressions The Algebra I Interactive Series is designed to incorporate all modalities of learning into one easy to use learning tool; thereby reinforcing learning

### Cryptography: Motivation. Data Structures and Algorithms Cryptography. Secret Writing Methods. Many areas have sensitive information, e.g.

Cryptography: Motivation Many areas have sensitive information, e.g. Data Structures and Algorithms Cryptography Goodrich & Tamassia Sections 3.1.3 & 3.1.4 Introduction Simple Methods Asymmetric methods:

### 2. Compressing data to reduce the amount of transmitted data (e.g., to save money).

Presentation Layer The presentation layer is concerned with preserving the meaning of information sent across a network. The presentation layer may represent (encode) the data in various ways (e.g., data

### The relationship of a trees to a graph is very important in solving many problems in Maths and Computer Science

Trees Mathematically speaking trees are a special class of a graph. The relationship of a trees to a graph is very important in solving many problems in Maths and Computer Science However, in computer

### Chapter 4: Computer Codes

Slide 1/30 Learning Objectives In this chapter you will learn about: Computer data Computer codes: representation of data in binary Most commonly used computer codes Collating sequence 36 Slide 2/30 Data