Teaching Cryptography

Dariia Porechna, Wolfram

(RowDefault[, (Spacer1), , (Spacer1), ])  #WolframTechConf

ABSTRACT

Cryptography is fascinating because of the close ties it forges between theory and practice. It makes use of bitwise computations, advanced algebra, string operations and everything in between. Explaining cryptography requires not only showing the math behind it, but also tying it to real-world scenarios. 
This talk will share an experience of writing about cryptography and how the Wolfram Language allows one to deliver unique hands-on educational material on the matter.

MOOC Goals

Give an overview of the field, its existing methods and some open problems

Present important cryptographic tools conjointly

Tie the algorithms to their real-world use

Make sense of math behind the algorithms without diving too deep

Cover both fundamentals and some more advanced exciting notions

Introduction to Cryptography MOOC Structure

25 lessons, ~10 min each

Chapters:

Historic perspective

Time-honored techniques

Essential terminology and concepts

Hash functions

Symmetric cryptography

Asymmetric cryptography

Applications of interest

Notions of security

Historic Perspective

Brief overview of the history of the field and evolution of goals and use

Steganography

Codes vs ciphers

"The enemy knows the system" principle

Era of cipher machines

Modern cryptography

Time-honoured techniques

Caesar cipher, Vigenerè cipher

Substitution ciphers, transposition ciphers

Requirements for a perfectly secure encryption system, one-time pad

Essential terminology and concepts

Vocabulary

Modern objectives of cryptography

What do words secure and broken actually mean?

Security models

Brute-force attack

Need for, use and sources of (pseudo)random number sequences

Hash functions

Definition, applications

Difference to ciphers

Collision-resistance

Avalanche effect

Symmetric cryptography

Two-party communication using secret-key encryption

Historic overview: DES, AES

Basic principles of operation of block ciphers, block modes.

Stream ciphers

Common designs for a block cipher: substitution-permutation networks and Feistel scheme

Asymmetric cryptography

Concept of public and private key pair

Pros and cons in comparison to symmetric key scheme

Digital signatures

RSA cryptosystem and it’s security

Elliptic curve cryptosystems

Applications of interest

Hybrid cryptography - combination of different types of algorithms for secure communication

Public-key infrastructure

Cryptocurrencies

Key derivation

Notions of security

Security is relative

Image source: xkcd (https://xkcd.com/538)

Steganography

Get the book:

text = ToCharacterCode@ExampleData[{"Text","AliceInWonderland"}];

Get an image:

pic=ExampleData[{"TestImage","Sailboat"}]

Split the image into RGB channels:

{red, green, blue} =ColorSeparate[pic]

Get the bytes of the red channel:

bytes =Flatten[ImageData[red,"Byte"]]

Check if the book fits the image:

Length[text]

Floor[Times@@ImageDimensions[pic]/5]

Create replacement rules:

replacement=MapIndexed[Rule[5#2[[1]],#1]&,text];
replacement[[1;;10]]

Make the new red channel:

newred = Image[Partition[ReplacePart[bytes,replacement],512],"Byte"]

Compose the new image:

newpic=ColorCombine[{newred,green,blue}]

Compare the images:

ImageCollage[{pic,newpic}]

Sneak peek

Take a close look at this picture of a boat in a calm lake:

photo =;

Look at the red, green and blue color channels separately:

channels =ColorSeparate[photo];
ImageCollage[channels, Method->"Columns"]

Try to decode the bytes of the red channel as text:

text=FromCharacterCode[Flatten[ImageData[First[channels],"Byte"]]];

Peek the first few lines of the text uncovered:

Snippet[text, 10]

While this may not look promising to you, who happened to intercept this image, its intended recipient knows that they would have to look at every fifth byte to reveal the hidden message:

StringTake[text,1;;2000;;5]

Thank you!