CMPT 120 Lecture 9 – Unit 2 – Cryptography and Encryption –

Slides:



Advertisements
Similar presentations
CMSC 104, Version 9/011 Arithmetic Operators Topics Arithmetic Operators Operator Precedence Evaluating Arithmetic Expressions In-class Project Incremental.
Advertisements

Types and Arithmetic Operators
Computer Science 101 Data Encryption And Computer Networks.
Public Key Encryption Algorithm
1 Expressions, Operators Expressions Operators and Precedence Reading for this class: L&L, 2.4.
Programming in Python Part I Dr. Fatma Cemile Serçe Atılım University
Cryptography Data communications and networks Momina Tariq: Ambreen Sohail: Data Communications and Networks.
Chapter 3: Data Types and Operators JavaScript - Introductory.
ORDER OF OPERATIONS x 2 Evaluate the following arithmetic expression: x 2 Each student interpreted the problem differently, resulting in.
Input, Output, and Processing
Arithmetic Operators Topics Arithmetic Operators Operator Precedence
1 INTRODUCTION TO PROBLEM SOLVING AND PROGRAMMING.
Python Programming in Context Chapter 3. Objectives To introduce the string data type To demonstrate the use of string methods and operators To introduce.
Building Java Programs Primitive Data and Definite Loops.
CMSC 104, Version 8/061L10ArithmeticOps.ppt Arithmetic Operators Topics Arithmetic Operators Operator Precedence Evaluating Arithmetic Expressions In-class.
Doing math In java.
Computer Security Lecture 5 Ch.9 Public-Key Cryptography And RSA Prepared by Dr. Lamiaa Elshenawy.
PYTHON VARIABLES : CHAPTER 2 FROM THINK PYTHON HOW TO THINK LIKE A COMPUTER SCIENTIST.
AOIT Introduction to Programming Unit 2, Lesson 6 Arithmetic Operators and Operator Precedence Copyright © 2009–2012 National Academy Foundation. All rights.
Lecture 3 (Chapter 9) Public-Key Cryptography and RSA Prepared by Dr. Lamiaa M. Elshenawy 1.
CSCI 1100/1202 January 18, Arithmetic Expressions An expression is a combination of operators and operands Arithmetic expressions compute numeric.
1 09/10/04CS150 Introduction to Computer Science 1 What Actions Do We Have Part 2.
Public Key Cryptography. Asymmetric encryption is a form of cryptosystem in which Encryption and decryption are performed using the different keys—one.
CMSC201 Computer Science I for Majors Lecture 03 – Operators
Topics Designing a Program Input, Processing, and Output
Arithmetic Operators Topics Arithmetic Operators Operator Precedence
Encryption.
CMSC201 Computer Science I for Majors Lecture 04 – Expressions
BASIC ELEMENTS OF A COMPUTER PROGRAM
Lecture 4: Expressions and Variables
Topic: Python’s building blocks -> Statements
Building Java Programs
Topic: Conditional Statements – Part 2
Expressions An expression is a portion of a C++ statement that performs an evaluation of some kind Generally requires that a computation or data manipulation.
Variables, Expressions, and IO
CMSC201 Computer Science I for Majors Lecture 03 – Operators
Arithmetic Operators Topics Arithmetic Operators Operator Precedence
Efficient CRT-Based RSA Cryptosystems
Arithmetic Operators Topics Arithmetic Operators Operator Precedence
Lecture 3: Expressions and Variables
Building Java Programs
Arithmetic Expressions & Data Conversions
Building Java Programs Chapter 2
Building Java Programs
Core Objects, Variables, Input, and Output
Expressions An expression is a portion of a C++ statement that performs an evaluation of some kind Generally requires that a computation or data manipulation.
Lecture 2: Static Methods Expressions reading: 1.4 – 2.1
CS150 Introduction to Computer Science 1
INC 161 , CPE 100 Computer Programming
Data Types and Expressions
Chapter 2 Programming Basics.
Topics Designing a Program Input, Processing, and Output
Building Java Programs
Lecture 4: Expressions and Variables
Arithmetic Operations
Topics Designing a Program Input, Processing, and Output
Building Java Programs
Arithmetic Operators Topics Arithmetic Operators Operator Precedence
Building Java Programs Chapter 2
Building Java Programs
Computer Security Chapter Two
CMPT 120 Lecture 12 – Unit 2 – Cryptography and Encryption –
is multiplied by a variable of type to yield a result of type
Data Types and Expressions
CMPT 120 Lecture 10 – Unit 2 – Cryptography and Encryption –
Lecture 17 – Practice Exercises 3
Arithmetic Expressions & Data Conversions
Data Types and Expressions
Introduction to Python
Building Java Programs
Presentation transcript:

CMPT 120 Lecture 9 – Unit 2 – Cryptography and Encryption – The realm of secret codes Python – Arithmetic and Strings

Unit 2 - Cryptography and Encryption - Secret codes When you log onto your SFU mail account, purchase goods on the Internet, check your grades or your bank account online, you are using cryptography. Cryptography is a field of study involving many disciplines such as mathematics, computing science, and engineering It encompasses various aspects such as data confidentiality, data integrity, and authentication Encryption is one of the aspects of cryptography that deals with the process of encoding a message using an algorithm

Unit 2 - Cryptography and Encryption - Secret codes In this unit, we'll see how we can encrypt/decrypt messages using Python programs To do so, we’ll need to learn How to manipulate characters in a string How to calculate How to loop in various ways How to write our own functions

Encryption - Secret codes Makes messages confidential, secret It does this by using an algorithm that transforms messages we can read into messages we can no longer read … and back to messages we can read We shall call messages we can read plaintext messages we cannot read ciphertext plaintext encryption ciphertext plaintext decryption ciphertext

Let’s give it a go! Problem Statement: Write a program that encrypts messages using a transposition algorithm called “odd&even” Transposition algorithm odd&even: Create a cypher that is made of 2 strings String 1 contains the characters in odd positions String 2 contains the characters in even positions Example:

Our first encryption algorithm In order to implement our first encryption algorithm, we need to know … String concatenation Arithmetic operator Running count algorithm

Reading Review

Let’s decrypt our message! Problem Statement: Write a program that decrypts messages that have been encrypted using the transposition algorithm odd&even

Our first decryption algorithm In order to implement our first decryption algorithm, we need to know … String concatenation Arithmetic operator Indexing Slicing len( ) function

Reading Review

Review: Arithmetic operators Addition: + Subtraction: - Multiplication: * Division: / Floor division: // Modulus: % Exponentiation: ** Syntax: <operand> <operator> <operand> Example: charCount = charCount + 1 < … > signifies “replace with an operand, i.e., an integer or a float” < … > signifies “replace with one operator”

Review: Order of Evaluation Highest precedence (expressions...) Parentheses P x[index], x[index : index],  x(arguments...) Subscription, slicing, call ** Exponentiation E *, /, //, % Multiplication, division, remainder MDR +, - Addition and subtraction AS <, <=, >, >=, !=, == Relational operators not Logical operator and or Lowest precedence

Next Lecture We shall continue our investigation of encryption/decryption In doing so, we shall look at range( ) function