CS166 HW1
Kaya Ota
2/8/2017
Chapter 1
#1: among the fundamental challengesininformationsecurity are confidentiality,integrity,and
availability,or CIA.
A: define eachof these terms
Confidentiality=topreventunauthorizedreadingof information.
Integrity= topreventunauthorizedwritingof information.
Availability=tomake data readyto use wheneveranauthorizeduserneedsit.
B: give a concrete example where confidentiality ismore important than integrity
Confidentialitywithlackof integrityisnotuseful databecause datamightnolongeraccurate / reliable.
C: give a concrete example where integrityis more important than confidentiality
Anytransactionthat isnot secretneedsintegritybecause lackof integritymightcauses uncoherent
resultof transaction.Forexample,assume thatXsends$100 to Y viaonline. If Trudyupdate/write data
withoutauthorization, thenYcannotreceive $100 fromX.
D: give a concrete example where availabilityisthe overridingconcerns.
Availability(dataavailability) iscritical foranyonline business,suchasamazon.com, because if their
data isnot available,theycannotruntheirownbusiness,i.e.theycannotopentheirshop.
Chapter2
#4 findthe plaintextand the key: CSYEVIXIVQMREXIH
youare terminated
N = 22
#6 programming assignment
#8
A: define the terms of confusionand diffusionas usedin cryptography
Confusion=obscure relationshipbetweenplaintextand ciphertext
Diffusion=spreadplaintextstatisticsthroughthe ciphertext
B: whichclassic cipher disusedinthis chapter employsonlyconfusion?
A simple substitution/one-time pad
C: which classic cipherdiscussedinthis chapter employsonly diffusion?
Double transpositioncipher
D: whichcipher discussedinthis chapter employsboth confusionand diffusion?
The ciphersfromthe electionof 1876
#14 encryptthe message “we are all together” usingdouble transpositioncipher.
W E A R
E A L L
T O G A
T H E R
Ciphertext= LEALETHRAWERGTOA
#15 decryptthe ciphertext
IAUTMOCSMN IMREBOTNEL STRHEREOAE VMWIH
TSEEA TMAEOHWHSY CEELTTEOHM UOUFEHTRFT
This message was encryptedwith a double transposition(oftype discussedinthe textbook) using
matrix of 7 rows and 10 columns. Hint: first word is “there”
I A U T M O C S M N
I M R E B O T N E L
S T R H E R E O A E
V M W I H T S E E A
T M A E O H W H S Y
C E E L T T E O H M
U O U F E H T R F T
#19 Usingletterencodingsintable 2.1, the followingcipher-textmessage wasencryptedwith one-
time pad: KITLKE
LETTER e h i k l r s T
BINARY 000 001 010 011 100 101 110 111
C = KITLKE = 011 010 111 100 011 000
A: if the plaintextis “thrill”,what is the key?
Putative P= 111 001 101 010 100 100
Putative K= C XOR Putative P
= 100 011 010 110 111 100 = LKISTL
L E A L
E T H R
A W E R
G T O A
B: ifthe plaintextis“tiller”,whatis the key?
Putative P= 111 010 100 100 000 100
Putative K= C XOR Putative P
= 100 000 011 000 011 100 = LEKEKR
#22 Suppose that the followingisan example from the descriptioncodebookfor a classic codebook
cipher.
123 199 202 221 233 332 451
once or maybe twice time upon a
Decrypt the followingcipher-text:242, 554, 650, 464, 532, 749, 567
Assumingthat the followingadditive sequence wasusedto encrypt the message:
119, 222, 199,231, 333,547,346
Once upona time or maybe twice
Not From A TextBook: Study a classic crypto systemnot addressedin the class and provide a brief
description.
Hill Cipher
Hill cipherwas inventedbyLesterS.Hill in1929, and isa poly-graphicsubstitutioncipher,whichuniform
substitutionperformedonblockof letters. Hill usesmatrix multiplicationandmoduloof 26 to mix up
the plaintext. He contributestointroduce mathematicstocryptosystemandcrypt analysis. However,
Hill cipheristoocomplicatedfordailyuse.
Example of hill cipher
Preparation
The keyof hill cipherisanysquare matrix.
Assume ourplaintextis“ATTACK”andkeymatrix is 𝐾 = [
2 4 5
9 2 1
3 17 7
]
We needtobreakdownthe plaintextinto the numberof rowsorcolumns (theyhasto be the same).In
thisexample,the keymatrix has3rows and 3 columns,sowe needto breakdownthe plaintextinto3,
“ATT” and “ACK”.
We create a vectorcorrespondingto the letterof the plaintext.Let’ssayA is0, B is 1, C is 2, and so on.
“ATT" = [
0
19
19
] and "ACK" = [
0
2
10
]
Encryption
To encrypt,We performmatrix multiplicationandtake moduleof 26
[
2 4 5
9 2 1
3 17 7
][
0
19
19
] = [
171
57
456
]  [
171
57
456
]( 𝑚𝑜𝑑 26) = [
15
5
14
] = [
𝑃
𝐹
𝑂
]  thisisciphertextfor“ATT”
[
2 4 5
9 2 1
3 17 7
][
0
2
10
] = [
18
6
104
]  [
18
6
104
]( 𝑚𝑜𝑑 26) = [
18
6
0
] = [
𝑆
𝐺
𝐴
] thisisciphertextfor“ACK”
Decryption
To decrypt, We needto findaninverse matrix modulo26to use as decryptionkey.The equationbelow
shouldbe hold.
𝐾−1 [
15
5
14
] ( 𝑚𝑜𝑑 26) = [
0
19
19
] = "𝐴𝑇𝑇" where 𝐾−1 isthe inverse matrix of K
We wishtofind 𝐾−1 such that K × K−1 = 𝐼 where I isidentitymatrix.
We attempttocalculate 𝐾−1 by keymatrix,dwhichis determinant of matrices K,andmatrix adjudges.
The formulabelowtellshowtofind 𝐾−1
K−1 = 𝑑−1 × 𝑎𝑑𝑗(𝐾) where d × d−1 = 1 and 𝑎𝑑𝑗( 𝐾) isthe adjugate matrix i.e.adjointof square
matrix,whichisthe transpose of itscofactor matrix.
Reference:
http://practicalcryptography.com/ciphers/hill-cipher/

Cs166 hw1

  • 1.
    CS166 HW1 Kaya Ota 2/8/2017 Chapter1 #1: among the fundamental challengesininformationsecurity are confidentiality,integrity,and availability,or CIA. A: define eachof these terms Confidentiality=topreventunauthorizedreadingof information. Integrity= topreventunauthorizedwritingof information. Availability=tomake data readyto use wheneveranauthorizeduserneedsit. B: give a concrete example where confidentiality ismore important than integrity Confidentialitywithlackof integrityisnotuseful databecause datamightnolongeraccurate / reliable. C: give a concrete example where integrityis more important than confidentiality Anytransactionthat isnot secretneedsintegritybecause lackof integritymightcauses uncoherent resultof transaction.Forexample,assume thatXsends$100 to Y viaonline. If Trudyupdate/write data withoutauthorization, thenYcannotreceive $100 fromX. D: give a concrete example where availabilityisthe overridingconcerns. Availability(dataavailability) iscritical foranyonline business,suchasamazon.com, because if their data isnot available,theycannotruntheirownbusiness,i.e.theycannotopentheirshop. Chapter2 #4 findthe plaintextand the key: CSYEVIXIVQMREXIH youare terminated N = 22 #6 programming assignment #8 A: define the terms of confusionand diffusionas usedin cryptography Confusion=obscure relationshipbetweenplaintextand ciphertext Diffusion=spreadplaintextstatisticsthroughthe ciphertext B: whichclassic cipher disusedinthis chapter employsonlyconfusion?
  • 2.
    A simple substitution/one-timepad C: which classic cipherdiscussedinthis chapter employsonly diffusion? Double transpositioncipher D: whichcipher discussedinthis chapter employsboth confusionand diffusion? The ciphersfromthe electionof 1876 #14 encryptthe message “we are all together” usingdouble transpositioncipher. W E A R E A L L T O G A T H E R Ciphertext= LEALETHRAWERGTOA #15 decryptthe ciphertext IAUTMOCSMN IMREBOTNEL STRHEREOAE VMWIH TSEEA TMAEOHWHSY CEELTTEOHM UOUFEHTRFT This message was encryptedwith a double transposition(oftype discussedinthe textbook) using matrix of 7 rows and 10 columns. Hint: first word is “there” I A U T M O C S M N I M R E B O T N E L S T R H E R E O A E V M W I H T S E E A T M A E O H W H S Y C E E L T T E O H M U O U F E H T R F T #19 Usingletterencodingsintable 2.1, the followingcipher-textmessage wasencryptedwith one- time pad: KITLKE LETTER e h i k l r s T BINARY 000 001 010 011 100 101 110 111 C = KITLKE = 011 010 111 100 011 000 A: if the plaintextis “thrill”,what is the key? Putative P= 111 001 101 010 100 100 Putative K= C XOR Putative P = 100 011 010 110 111 100 = LKISTL L E A L E T H R A W E R G T O A
  • 3.
    B: ifthe plaintextis“tiller”,whatisthe key? Putative P= 111 010 100 100 000 100 Putative K= C XOR Putative P = 100 000 011 000 011 100 = LEKEKR #22 Suppose that the followingisan example from the descriptioncodebookfor a classic codebook cipher. 123 199 202 221 233 332 451 once or maybe twice time upon a Decrypt the followingcipher-text:242, 554, 650, 464, 532, 749, 567 Assumingthat the followingadditive sequence wasusedto encrypt the message: 119, 222, 199,231, 333,547,346 Once upona time or maybe twice Not From A TextBook: Study a classic crypto systemnot addressedin the class and provide a brief description. Hill Cipher Hill cipherwas inventedbyLesterS.Hill in1929, and isa poly-graphicsubstitutioncipher,whichuniform substitutionperformedonblockof letters. Hill usesmatrix multiplicationandmoduloof 26 to mix up the plaintext. He contributestointroduce mathematicstocryptosystemandcrypt analysis. However, Hill cipheristoocomplicatedfordailyuse. Example of hill cipher Preparation The keyof hill cipherisanysquare matrix. Assume ourplaintextis“ATTACK”andkeymatrix is 𝐾 = [ 2 4 5 9 2 1 3 17 7 ] We needtobreakdownthe plaintextinto the numberof rowsorcolumns (theyhasto be the same).In thisexample,the keymatrix has3rows and 3 columns,sowe needto breakdownthe plaintextinto3, “ATT” and “ACK”. We create a vectorcorrespondingto the letterof the plaintext.Let’ssayA is0, B is 1, C is 2, and so on.
  • 4.
    “ATT" = [ 0 19 19 ]and "ACK" = [ 0 2 10 ] Encryption To encrypt,We performmatrix multiplicationandtake moduleof 26 [ 2 4 5 9 2 1 3 17 7 ][ 0 19 19 ] = [ 171 57 456 ]  [ 171 57 456 ]( 𝑚𝑜𝑑 26) = [ 15 5 14 ] = [ 𝑃 𝐹 𝑂 ]  thisisciphertextfor“ATT” [ 2 4 5 9 2 1 3 17 7 ][ 0 2 10 ] = [ 18 6 104 ]  [ 18 6 104 ]( 𝑚𝑜𝑑 26) = [ 18 6 0 ] = [ 𝑆 𝐺 𝐴 ] thisisciphertextfor“ACK” Decryption To decrypt, We needto findaninverse matrix modulo26to use as decryptionkey.The equationbelow shouldbe hold. 𝐾−1 [ 15 5 14 ] ( 𝑚𝑜𝑑 26) = [ 0 19 19 ] = "𝐴𝑇𝑇" where 𝐾−1 isthe inverse matrix of K We wishtofind 𝐾−1 such that K × K−1 = 𝐼 where I isidentitymatrix. We attempttocalculate 𝐾−1 by keymatrix,dwhichis determinant of matrices K,andmatrix adjudges. The formulabelowtellshowtofind 𝐾−1 K−1 = 𝑑−1 × 𝑎𝑑𝑗(𝐾) where d × d−1 = 1 and 𝑎𝑑𝑗( 𝐾) isthe adjugate matrix i.e.adjointof square matrix,whichisthe transpose of itscofactor matrix. Reference: http://practicalcryptography.com/ciphers/hill-cipher/