info-231: introduction to mathematical foundations of security

43
INFO-231: Introduction to Mathematical Foundations of Security Yan Huang [email protected]

Upload: buithien

Post on 14-Feb-2017

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: INFO-231: Introduction to Mathematical Foundations of Security

INFO-231:IntroductiontoMathematicalFoundationsof

SecurityYanHuang

[email protected]

Page 2: INFO-231: Introduction to Mathematical Foundations of Security

YanHuang

ResearchInterests:SecurityAlgorithmsFunctionalProgrammingSystemsCryptography

Iamlookingformotivated undergraduateresearchers.

Page 3: INFO-231: Introduction to Mathematical Foundations of Security

CourseAdministrivia

• Website:http://homes.soic.indiana.edu/yh33/Teaching/I231-2016/syllabus.html

• TA:Ruiyu Zhu([email protected])

OfficeHours:Tuesday1-2.GA1stfloorLobby

Page 4: INFO-231: Introduction to Mathematical Foundations of Security

• Textbooks:(bothfromCambridgeUniversityPress)-[required]ProgramminginHaskell,GrahamHutton-[required]ACryptographyPrimer:SecretsandPromises,PhilipKlein-[recommended]AnIntroductiontoMathematicalCryptography,J.Hoffstein,J.Pipher,J.H.Silverman

Page 5: INFO-231: Introduction to Mathematical Foundations of Security

Goalsofthiscourse

• Stimulateyourinterestsin-Mathematics-Computerprogramming

• SomeusefulMathideas-Prepareforlatercourses-Benefityourfuturecareer

Page 6: INFO-231: Introduction to Mathematical Foundations of Security

Componentsofthiscourse

Haskellprogramming Algebra Probability

ComputationalComplexity Applications

Page 7: INFO-231: Introduction to Mathematical Foundations of Security

Grades

Homework 40%Quiz 20%Final 40%

ü Everyhomeworkassignmentcounts.ü Nolatehomeworkwillbeaccepted.ü Finalgradesarecurvedattheendofthesemester.

Page 8: INFO-231: Introduction to Mathematical Foundations of Security

HomeworkPolicy

• Youcandiscusstheproblemswithotherstudentsintheclass,buteveryoneshouldtypeuptheanswersindependently.•Onyoursubmittedpaper-Creditwhoyouhaveobtainedhelpfrom-Writedownwhoyouhaveofferedhelpto

•Plagiarism willalwaysbereportedandcauseafailureofthiscourse.

Page 9: INFO-231: Introduction to Mathematical Foundations of Security

Morepolicies

• Quizzes- Closedbook,Closednotes- Canhappenduringanylecture- Zeropointonquizzesinlecturesofyourabsence- Threeworstscoresautomaticallydropped(e.g.,duetomissingattendance)- Classattendanceisrequiredunlessyoudemonstratetomethatyoumasteredthelecturecontentsinadvance.Mustobtainpermissiontoskiplectures.

• Final- Openbook,takehome- Nocollaboration- Musttypeupandsubmitelectronically

Page 10: INFO-231: Introduction to Mathematical Foundations of Security

HowtogetanA+?

• Factorizethefollowingnumber18972103309983185422070079784284135489247092848422646286183818473249588683594416952182594240975017401464914844829644057472091352613798743747335777323090555389223730308478401116881894745108157937909744782288166743288290437938219276578533448462609296449172456761389565857363582344032070416444543015461461122896482189610796592683838338989940716029100970716520372844169319105436448070434656299302954568678624394202272254732416359831107671563742819816642703632813340191086021800655300132599105525940099006490449928844475189704589770072655514199831106264576993649173200857755181189779752280025089963275809434722408052661993

• Finishyourassignmentsreasonablywellanddemonstrateyourabilityofproactivelearning- Studyrelevantmaterialsnotcovered/requiredinclass- Implementchallengingstuff- Solveoptionalproblems Dotalktomeinadvanceto

settledownyourspecificplans

Page 11: INFO-231: Introduction to Mathematical Foundations of Security

EnvironmentSetup

Page 12: INFO-231: Introduction to Mathematical Foundations of Security

Bringyourlaptoptoclass-Quizzes- Tryoutideasonthefly.

Page 13: INFO-231: Introduction to Mathematical Foundations of Security

Madoko• https://www.madoko.net/- ConnectswellwithDropbox,Github,Onedrive etc.

• Detailedreferencemanual:http://research.microsoft.com/en-us/um/people/daan/madoko/doc/reference.html

• YouarerequiredtotypeupyourassignmentsusingeitherMadoko orLaTeX.

Daan Leijen,creatorofMadoko.

Page 14: INFO-231: Introduction to Mathematical Foundations of Security

Madoko

• Italic*important* =>important

• Boldface**important** =>important

• Inlinemath$ f(x) = x^2 + 1 $

•Displayedmath~ Equation { #eqn-label }W = F \cdot s~

Page 15: INFO-231: Introduction to Mathematical Foundations of Security

Madoko

• Superscripts(^)andSubscripts(~)- E.g.,Black_pit_, Ball~sky~

• Strikeout(~~,twotildes)- E.g.,There is a ~~strike out~~ here.

• Links- E.g.,[Google](http://www.google.com).

• Images![bfly][bfly]: images/butterfly-200.png "A Monarch" { width: 100px }

Page 16: INFO-231: Introduction to Mathematical Foundations of Security

Madoko Blocks

• Equivalently~ Begin Equation

W = F \cdot s~

•BlockforDisplayedmath~ Equation W = F \cdot s~

• Nestedblocks~ EquationF=ma

~~ EquationAn nested equation distinguished by double tildes

~~~

Page 17: INFO-231: Introduction to Mathematical Foundations of Security

Madoko 1𝑛

\frac{1}{n}

𝑥$ x_1

Lim \lim

mod \mod

→ \rightarrow

∞ \infty

• $...$markstheregionwhere

LaTeXmath-mode applies

• LaTeX symbollookup:

http://detexify.kirelabs.org/cl

assify.html

Page 18: INFO-231: Introduction to Mathematical Foundations of Security

Madoko

• Embeddingprogramcode

``` haskellmain = print “Hello World!”```

Page 19: INFO-231: Introduction to Mathematical Foundations of Security

WhyHaskell?

•Presentmathideas-Precise-Succinct-Easytoexperiment

•Abonusskilltoyouradventurousfuture§Functionalprogramming:thebasicmethodofcomputationis applicationoffunctionstoarguments

Page 20: INFO-231: Introduction to Mathematical Foundations of Security

WhyHaskell?Alanguagethatdoesn'taffectthewayyouthinkaboutprogrammingisnotworthknowing.

Agoodprogramminglanguageisaconceptualuniverseforthinkingaboutprogramming.

-- AlanPerlisProfessorofYale

ThefirstTuringAwardLaureate

Page 21: INFO-231: Introduction to Mathematical Foundations of Security

HistoricalBackground

1930s:

AlonzoChurchdevelopsthelambdacalculus,asimplebutpowerfultheoryoffunctions.

Page 22: INFO-231: Introduction to Mathematical Foundations of Security

HistoricalBackground

1950s:

JohnMcCarthydevelopsLisp,thefirstfunctionallanguage,withsomeinfluencesfromthelambdacalculus,butretainingvariableassignments.

Page 23: INFO-231: Introduction to Mathematical Foundations of Security

HistoricalBackground

1970s:

JohnBackusdevelopsFP,afunctionallanguagethatemphasizeshigher-orderfunctions andreasoningaboutprograms.

Page 24: INFO-231: Introduction to Mathematical Foundations of Security

HistoricalBackground

1970s:

RobinMilnerandothersdevelopML,thefirstmodernfunctionallanguage,whichintroducedtypeinference andpolymorphictypes.

Page 25: INFO-231: Introduction to Mathematical Foundations of Security

HistoricalBackground

1987:

AninternationalcommitteeofresearchersinitiatesthedevelopmentofHaskell,astandardlazyfunctionallanguage.

Page 26: INFO-231: Introduction to Mathematical Foundations of Security

HistoricalBackground

1990s:

PhilWadler andothersdeveloptypeclasses andmonads,twoofthemaininnovationsofHaskell.

Page 27: INFO-231: Introduction to Mathematical Foundations of Security

HistoricalBackground

2003:

ThecommitteepublishestheHaskellReport,definingastableversionofthelanguage;anupdatedversionwaspublishedin2010.

Page 28: INFO-231: Introduction to Mathematical Foundations of Security

HistoricalBackground

2010-date:

Standarddistribution,librarysupport,newlanguagefeatures,developmenttools,useinindustry,influenceonotherlanguages,etc.

Page 29: INFO-231: Introduction to Mathematical Foundations of Security

ExamplePracticalUses

• Haxl — Facebook'santi-spamprogram• Cryptol — Alanguageandtoolchainfordevelopingandverifyingcryptographyalgorithms• seL4 — Thefirstformallyverifiedmicrokernel…

Page 30: INFO-231: Introduction to Mathematical Foundations of Security

ExampleHaskellCode

• Summingtheintegers1to10inJava:

• InHaskell,thisissimplyaone-liner

int total = 0;for (int i = 1; i <= 10; i++)total = total + i;

sum [1..10]

Themethodofcomputationis variableassignment.

Page 31: INFO-231: Introduction to Mathematical Foundations of Security

InstallingHaskell

GLASGOWHASKELLCOMPILER(GHC)• Freelyavailable

https://www.haskell.org/platform/• AleadingimplementationofHaskellcomprisingacompilerghc andaninterpreter ghci• Theinteractivenatureoftheinterpretermakesitwell-suitedforteachingandprototyping

Page 32: INFO-231: Introduction to Mathematical Foundations of Security

StartingGHCi

“Prelude λ:” promptsforHaskellexpressionstoevaluate.

$ ghci

GHCi, version X: http://www.haskell.org/ghc/ :? for help

Prelude λ:

Page 33: INFO-231: Introduction to Mathematical Foundations of Security

GHCi asadesktopcalculator

Prelude λ: 2+3*4

14

Prelude λ: (4+1)*5

25

Prelude λ: 3^2

9

Prelude λ: sqrt (3^2 + 4^2)

5.0

Page 34: INFO-231: Introduction to Mathematical Foundations of Security

TheStandardPrelude

Haskellcomeswithalargenumberofstandardlibraryfunctions.E.g.,thelibraryalsoprovidesmanyusefulfunctionsonlists.

z Selectthefirstelementofalist:

Prelude λ: head [1,2,3,4,5]1

Page 35: INFO-231: Introduction to Mathematical Foundations of Security

z Removethefirstelementfromalist:

Prelude λ: tail [1,2,3,4,5][2,3,4,5]

z Selectthenthelementofalist:(listindexstartsfrom0)

Prelude λ: [1,2,3,4,5] !! 23

z Selectthefirstnelementsofalist:

Prelude λ: take 3 [1,2,3,4,5][1,2,3]

Page 36: INFO-231: Introduction to Mathematical Foundations of Security

z Removethefirstnelementsfromalist:

Prelude λ: drop 3 [1,2,3,4,5][4,5]

z Calculatethelengthofalist:

Prelude λ: length [1,2,3,4,5]5

z Calculatethesumofalistofnumbers:

Prelude λ: sum [1,2,3,4,5]15

Page 37: INFO-231: Introduction to Mathematical Foundations of Security

z Calculatetheproductofalistofnumbers:

Prelude λ: product [1,2,3,4,5]120

z Appendtwolists:

Prelude λ: [1,2,3] ++ [4,5][1,2,3,4,5]

z Reversealist:

Prelude λ: reverse [1,2,3,4,5][5,4,3,2,1]

Page 38: INFO-231: Introduction to Mathematical Foundations of Security

FunctionApplication

Inmathematics,functionapplicationisdenotedusingparentheses,andmultiplicationisoftendenotedusingjuxtapositionorspace.

f(a,b) + c d

Applythefunctionf toa andb,andaddtheresulttotheproductofc andd.

Page 39: INFO-231: Introduction to Mathematical Foundations of Security

InHaskell,functionapplicationisdenotedusingspace,andmultiplicationisdenotedusing*.

f a b + c*d

Aspreviously,butinHaskellsyntax.

Page 40: INFO-231: Introduction to Mathematical Foundations of Security

Moreover,functionapplicationisassumedtohavehigherpriority thanallotheroperators.

f a + b

Means(f a) + b,ratherthanf (a + b).

Page 41: INFO-231: Introduction to Mathematical Foundations of Security

ExamplesMathematics Haskell

f(x)

f(x,y)

f(g(x))

f(x,g(y))

f(x)g(y)

f x

f x y

f (g x)

f x (g y)

f x * g y

f(-1) f (-1)

Page 42: INFO-231: Introduction to Mathematical Foundations of Security

UsefulGHCiCommandsCommand Meaning

:load name load script name:reload reload current script:set editor name set editor to name:edit name edit script name:edit edit current script:type expr show type of expr:? show all commands:quit quit GHCi

Page 43: INFO-231: Introduction to Mathematical Foundations of Security

Charge

• Haskell- InstallHaskellPlatformonyourcomputer.- TryouttheGHCi evaluationscoveredinthislecture.

• Madoko- ReadthroughMadoko’s referencemanual- TryoutMadoko tricksasyoureadthemanual.

• Homework0announced- Startearly!- SubmitthroughCanvas