Successfully reported this slideshow.
Upcoming SlideShare
×

of

Upcoming SlideShare
Next

1 Like

Share

# ZendCon 2018 - Cryptography in Depth

Cryptography is the invisible layer protecting everything around us. As software engineers, we are required to have some understanding of cryptography. Most of us only have a cursory understanding. Let’s dive deep into algorithms and modes for encryption, digital signatures, hashing, and key derivation. To get the most from this presentation, it is expected that you have a basic understanding of cryptography.

See all

See all

### ZendCon 2018 - Cryptography in Depth

6. 6. @adam_englander 4,294,967,296 Total messages 365 Days/year 8,171 Encryptions/min ➗ 24 Hours/day➗ 60 Minutes/hour➗
8. 8. @adam_englander CSPRNGs and the Entropy Pools
14. 14. @adam_englander Which one should I use?
15. 15. @adam_englander paragonie/rand_compat CSPRNG Functions
21. 21. @adam_englander The Problem is Trust
22. 22. @adam_englander Too Many Keys
24. 24. @adam_englander Difﬁe-Hellman Key Exchange The magic of modular arithmetic
25. 25. @adam_englander Public Key Cryptography
26. 26. @adam_englander Modular Arithmetic Magic
27. 27. @adam_englander Very Large Prime Numbers
28. 28. @adam_englander Which one should I use?
29. 29. @adam_englander Public Key Shared Secret
43. 43. @adam_englander OAEP a.k.a PKCS#1v2
46. 46. @adam_englander This is a block split se ntence22
47. 47. @adam_englander Key Key Expansion Add RoundKey Round 1 Key Round 2 to n-1 Key Round n Key Round 1 Round n Ciphertext Block Round 2 to (n-1) Plaintext Block
48. 48. @adam_englander Key Key Expansion Add RoundKey Round 1 Key Round 2 to n-1 Key Round n Key Round 1 Round n Ciphertext Block Round 2 to (n-1) Plaintext Block
49. 49. @adam_englander Rijandel Key Schedule
50. 50. @adam_englander Key Key Expansion AddRoundKey Round 1 Key Round 2 to n-1 Key Round n Key Round 1 Round n Ciphertext Block Round 2 to (n-1) Input Block
52. 52. @adam_englander Key Key Expansion Add RoundKey Round 1 Key Round 2 to n-1 Key Round n Key Round 1 Round n Ciphertext Block Round 2 to (n-1) Input Block
53. 53. @adam_englander Key Key Expansion Add RoundKey Round 1 Key Round 2 to n-1 Key Round n Key Round 1 Round n Ciphertext Block Round 2 to (n-1) Input Block
54. 54. @adam_englander Key Key Expansion Add RoundKey Round 1 Key Round 2 to n-1 Key Round n Key Round 1 Round n Ciphertext Block Round 2 to (n-1) Input Block
55. 55. @adam_englander Rounds RoundKeySubBytes ShiftRows MixColumns AddRoundKey Input Block Output Block To Matrices To Bytes
56. 56. @adam_englander Rounds RoundKeySubBytes ShiftRows MixColumns AddRoundKey Input Block Output Block To Matrices To Bytes
57. 57. @adam_englander Rounds RoundKeySubBytes ShiftRows MixColumns AddRoundKey Input Block Output Block To Matrices To Bytes
58. 58. @adam_englander Bits to Byte Matrices b01 b05 b09 b13 b02 b06 b10 b14 b03 b07 b11 b15 b04 b08 b12 b16 b33 b37 b41 b45 b34 b38 b42 b46 b35 b39 b43 b47 B36 b40 b44 b48 b17 b21 b25 b29 b18 b22 b26 b30 b19 b23 b27 b31 b20 b24 b28 b32 b49 b53 b57 b61 b50 b54 b58 b62 b51 b55 b59 b63 b52 b56 b60 b64 1011010100001101111111101011101111000101111101111011011110000100
59. 59. @adam_englander Rounds RoundKeySubBytes ShiftRows MixColumns AddRoundKey Input Block Output Block To Matrices To Bytes
60. 60. @adam_englander SubBytes b01 b05 b09 b13 b02 b06 b10 b14 b03 b07 b11 b15 b04 b08 b12 b16
61. 61. @adam_englander SubBytes s01 b05 b09 b13 b02 b06 b10 b14 b03 b07 b11 b15 b04 b08 b12 b16
62. 62. @adam_englander SubBytes s01 s05 b09 b13 s02 b06 b10 b14 b03 b07 b11 b15 b04 b08 b12 b16
63. 63. @adam_englander SubBytes s01 b05 b09 b13 s02 b06 b10 b14 s03 b07 b11 b15 b04 b08 b12 b16
64. 64. @adam_englander SubBytes s01 s05 s09 s13 s02 s06 s10 s14 s03 s07 s11 s15 s04 s08 s12 s16
65. 65. @adam_englander Rounds RoundKeySubBytes ShiftRows MixColumns AddRoundKey Input Block Output Block To Matrices To Bytes
66. 66. @adam_englander ShiftRows b01 b05 b09 b13 b02 b06 b10 b14 b03 b07 b11 b15 b04 b08 b12 b16
67. 67. @adam_englander ShiftRows b01 b05 b09 b13 b02 b06 b10 b14 b03 b07 b11 b15 b04 b08 b12 b16
68. 68. @adam_englander ShiftRows b01 b05 b09 b13 b06 b10 b14 b02 b03 b07 b11 b15 b04 b08 b12 b16
69. 69. @adam_englander ShiftRows b01 b05 b09 b13 b06 b10 b14 b02 b11 b15 b03 b07 b04 b08 b12 b16
70. 70. @adam_englander ShiftRows b01 b05 b09 b13 b06 b10 b14 b02 b11 b15 b03 b07 b16 b04 b08 b12
71. 71. @adam_englander ShiftRows b01 b05 b09 b13 b06 b10 b14 b02 b11 b15 b03 b07 b16 b04 b08 b12
72. 72. @adam_englander Rounds RoundKeySubBytes ShiftRows MixColumns AddRoundKey Input Block Output Block To Matrices To Bytes
73. 73. @adam_englander Rounds RoundKeySubBytes ShiftRows MixColumns AddRoundKey Input Block Output Block To Matrices To Bytes
74. 74. @adam_englander MixColumns b01 b05 b09 b13 b02 b06 b10 b14 b03 b07 b11 b15 b04 b08 b12 b16
75. 75. @adam_englander MixColumns t01 b05 b09 b13 t02 b06 b10 b14 t03 b07 b11 b15 t04 b08 b12 b16
76. 76. @adam_englander MixColumns t01 t05 b09 b13 t02 t06 b10 b14 t03 t07 b11 b15 t04 t08 b12 b16
77. 77. @adam_englander MixColumns t01 t05 t09 b13 t02 t06 t10 b14 t03 t07 t11 b15 t04 t08 t12 b16
78. 78. @adam_englander MixColumns t01 t05 t09 t13 t02 t06 t10 t14 t03 t07 t11 t15 t04 t08 t12 t16
79. 79. @adam_englander Rounds RoundKeySubBytes ShiftRows MixColumns AddRoundKey Input Block Output Block To Matrices To Bytes
80. 80. @adam_englander Byte Matrices to Bits b01 b05 b09 b13 b02 b06 b10 b14 b03 b07 b11 b15 b04 b08 b12 b16 b33 b37 b41 b45 b34 b38 b42 b46 b35 b39 b43 b47 B36 b40 b44 b48 b17 b21 b25 b29 b18 b22 b26 b30 b19 b23 b27 b31 b20 b24 b28 b32 b49 b53 b57 b61 b50 b54 b58 b62 b51 b55 b59 b63 b52 b56 b60 b64 1011010100001101111111101011101111000101111101111011011110000100
81. 81. @adam_englander Rounds RoundKeySubBytes ShiftRows MixColumns AddRoundKey Input Block Output Block To Matrices To Bytes
84. 84. @adam_englander This is a block split se ntence22
85. 85. @adam_englander CBC ECB OFB CFB CTR GCM
86. 86. @adam_englander CBC ECB OFB CFB CTR GCM
87. 87. @adam_englander CBC ECB OFB CFB CTR GCM
88. 88. @adam_englander CBC ECB OFB CFB CTR GCM
89. 89. @adam_englander CBC ECB OFB CFB CTR GCM
90. 90. @adam_englander Electronic Cook Book (ECB)
93. 93. @adam_englander Cipher Block Chaining (CBC)
96. 96. @adam_englander Galois Counter Mode (GCM)
97. 97. @adam_englander Galois Counter Mode (GCM)
100. 100. @adam_englander Galois Counter Mode (GCM)
101. 101. @adam_englander Galois Counter Mode (GCM)
102. 102. @adam_englander Galois Counter Mode (GCM)
103. 103. @adam_englander Galois Counter Mode (GCM)
104. 104. @adam_englander Which mode should I use?
105. 105. @adam_englander Mode Padding Oracle Resistant? Nonce Reuse Resistant? CBC No Yes GCM Yes No
108. 108. @adam_englander PKCS#5/PKCS#7 The value of each added byte is the number of bytes that are added. The last value is always a pad.
109. 109. @adam_englander PKCS#5/7 Example Hello World
110. 110. @adam_englander PKCS#5/7 Example Hello World 48 65 6c 6c 6f 20 57 6f 72 6c 64 11 bytes
111. 111. @adam_englander PKCS#5/7 Example Hello World 48 65 6c 6c 6f 20 57 6f 72 6c 64 11 bytes 64 bytes - 11 bytes = 53 bytes = 0x35 bytes
112. 112. @adam_englander PKCS#5/7 Example Hello World 48 65 6c 6c 6f 20 57 6f 72 6c 64 11 bytes 64 bytes - 11 bytes = 53 bytes = 0x35 bytes 48 65 6c 6c 6f 20 57 6f 72 6c 64 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 64 byte padded value
113. 113. @adam_englander PKCS#5/7 Example Hello World 48 65 6c 6c 6f 20 57 6f 72 6c 64 11 bytes 64 bytes - 11 bytes = 53 bytes = 0x35 bytes 48 65 6c 6c 6f 20 57 6f 72 6c 64 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 64 byte padded value
114. 114. @adam_englander PKCS#5/7 Example Hello World 48 65 6c 6c 6f 20 57 6f 72 6c 64 11 bytes 64 bytes - 11 bytes = 53 bytes = 0x35 bytes 48 65 6c 6c 6f 20 57 6f 72 6c 64 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 64 byte padded value
115. 115. @adam_englander What if we have 64 characters?
116. 116. @adam_englander PKCS#5/7 64 Character Example This is a sixty four byte text that I am going to encrypt meow
117. 117. @adam_englander PKCS#5/7 64 Character Example This is a sixty four byte text that I am going to encrypt meow 54 68 69 73 20 69 73 20 61 20 73 69 78 74 79 20 66 6f 75 72 20 62 79 74 65 20 74 65 78 74 20 74 68 61 74 20 49 20 61 6d 20 67 6f 69 6e 67 20 74 6f 20 65 6e 63 72 79 70 74 20 6d 65 6f 77 64 bytes
118. 118. @adam_englander PKCS#5/7 64 Character Example This is a sixty four byte text that I am going to encrypt meow 54 68 69 73 20 69 73 20 61 20 73 69 78 74 79 20 66 6f 75 72 20 62 79 74 65 20 74 65 78 74 20 74 68 61 74 20 49 20 61 6d 20 67 6f 69 6e 67 20 74 6f 20 65 6e 63 72 79 70 74 20 6d 65 6f 77 64 bytes 64 bytes - 64 bytes = 0 bytes
119. 119. @adam_englander PKCS#5/PKCS#7 The value of each added byte is the number of bytes that are added. The last value is always a pad.
120. 120. @adam_englander PKCS#5/7 64 Character Example This is a sixty four byte text that I am going to encrypt meow 54 68 69 73 20 69 73 20 61 20 73 69 78 74 79 20 66 6f 75 72 20 62 79 74 65 20 74 65 78 74 20 74 68 61 74 20 49 20 61 6d 20 67 6f 69 6e 67 20 74 6f 20 65 6e 63 72 79 70 74 20 6d 65 6f 77 64 bytes 64 bytes - 64 bytes = 0 bytes 54 68 69 73 20 69 73 20 61 20 73 69 78 74 79 20 66 6f 75 72 20 62 79 74 65 20 74 65 78 74 20 74 68 61 74 20 49 20 61 6d 20 67 6f 69 6e 67 20 74 6f 20 65 6e 63 72 79 70 74 20 6d 65 6f 7740 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 128 byte padded value
121. 121. @adam_englander PKCS#5/7 64 Character Example This is a sixty four byte text that I am going to encrypt meow 54 68 69 73 20 69 73 20 61 20 73 69 78 74 79 20 66 6f 75 72 20 62 79 74 65 20 74 65 78 74 20 74 68 61 74 20 49 20 61 6d 20 67 6f 69 6e 67 20 74 6f 20 65 6e 63 72 79 70 74 20 6d 65 6f 77 64 bytes 64 bytes - 64 bytes = 0 bytes 54 68 69 73 20 69 73 20 61 20 73 69 78 74 79 20 66 6f 75 72 20 62 79 74 65 20 74 65 78 74 20 74 68 61 74 20 49 20 61 6d 20 67 6f 69 6e 67 20 74 6f 20 65 6e 63 72 79 70 74 20 6d 65 6f 7740 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 128 byte padded value
122. 122. @adam_englander PKCS#5/7 64 Character Example This is a sixty four byte text that I am going to encrypt meow 54 68 69 73 20 69 73 20 61 20 73 69 78 74 79 20 66 6f 75 72 20 62 79 74 65 20 74 65 78 74 20 74 68 61 74 20 49 20 61 6d 20 67 6f 69 6e 67 20 74 6f 20 65 6e 63 72 79 70 74 20 6d 65 6f 77 64 bytes 64 bytes - 64 bytes = 0 bytes 54 68 69 73 20 69 73 20 61 20 73 69 78 74 79 20 66 6f 75 72 20 62 79 74 65 20 74 65 78 74 20 74 68 61 74 20 49 20 61 6d 20 67 6f 69 6e 67 20 74 6f 20 65 6e 63 72 79 70 74 20 6d 65 6f 7740 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 128 byte padded value
124. 124. @adam_englander Salsa20 The new hotness!
125. 125. @adam_englander Cons Key Key Key Key Cons Nonce Nonce Pos Pos Cons Key Key Key Key Cons
126. 126. @adam_englander Cons Key Key Key Key Cons Nonce Nonce Pos Pos Cons Key Key Key Key Cons Key Key Key Key Key Key Key Key
127. 127. @adam_englander Cons Key Key Key Key Cons Nonce Nonce Pos Pos Cons Key Key Key Key Cons Nonce Nonce
128. 128. @adam_englander Cons Key Key Key Key Cons Nonce Nonce Pos Pos Cons Key Key Key Key Cons Pos Pos
129. 129. @adam_englander Cons Key Key Key Key Cons Nonce Nonce Pos Pos Cons Key Key Key Key Cons Cons Cons Cons Cons
130. 130. @adam_englander Cons Key Key Key Key Cons Nonce Nonce Pos Pos Cons Key Key Key Key Cons Cons Cons Cons Cons
131. 131. @adam_englander Rounds 0 4 8 12 1 5 9 13 2 6 10 14 3 7 11 15
132. 132. @adam_englander Even Rounds 0 4 8 12 1 5 9 13 2 6 10 14 3 7 11 15
133. 133. @adam_englander Even Rounds 0 4 8 12 1 5 9 13 2 6 10 14 3 7 11 15
134. 134. @adam_englander Even Rounds 0 4 8 12 1 5 9 13 2 6 10 14 3 7 11 15
135. 135. @adam_englander Even Rounds 0 4 8 12 1 5 9 13 2 6 10 14 3 7 11 15
136. 136. @adam_englander Odd Rounds 0 4 8 12 1 5 9 13 2 6 10 14 3 7 11 15
137. 137. @adam_englander Odd Rounds 0 4 8 12 1 5 9 13 2 6 10 14 3 7 11 15
138. 138. @adam_englander Odd Rounds 0 4 8 12 1 5 9 13 2 6 10 14 3 7 11 15
139. 139. @adam_englander Odd Rounds 0 4 8 12 1 5 9 13 2 6 10 14 3 7 11 15
140. 140. @adam_englander Round Manipulation b ⊕= (a ⊞ d) <<< 7 c ⊕= (b ⊞ a) <<< 9 d ⊕= (c ⊞ b) <<< 13 a ⊕= (d ⊞ c) <<< 18
141. 141. @adam_englander Round Manipulation b ⊕= (a ⊞ d) <<< 7 c ⊕= (b ⊞ a) <<< 9 d ⊕= (c ⊞ b) <<< 13 a ⊕= (d ⊞ c) <<< 18
142. 142. @adam_englander Round Manipulation b ⊕= (a ⊞ d) <<< 7 c ⊕= (b ⊞ a) <<< 9 d ⊕= (c ⊞ b) <<< 13 a ⊕= (d ⊞ c) <<< 18
143. 143. @adam_englander Round Manipulation b ⊕= (a ⊞ d) <<< 7 c ⊕= (b ⊞ a) <<< 9 d ⊕= (c ⊞ b) <<< 13 a ⊕= (d ⊞ c) <<< 18
144. 144. @adam_englander Round Manipulation b ⊕= (a ⊞ d) <<< 7 c ⊕= (b ⊞ a) <<< 9 d ⊕= (c ⊞ b) <<< 13 a ⊕= (d ⊞ c) <<< 18
145. 145. @adam_englander ChaCha Mixes it up a bit
146. 146. @adam_englander Cons Cons Cons Cons Key Key Key Key Key Key Key Key Pos Pos Nonce Nonce
147. 147. @adam_englander Odd Rounds 0 4 8 12 1 5 9 13 2 6 10 14 3 7 11 15
148. 148. @adam_englander Odd Rounds 0 4 8 12 1 5 9 13 2 6 10 14 3 7 11 15
149. 149. @adam_englander Odd Rounds 0 4 8 12 1 5 9 13 2 6 10 14 3 7 11 15
150. 150. @adam_englander Odd Rounds 0 4 8 12 1 5 9 13 2 6 10 14 3 7 11 15
151. 151. @adam_englander Even Rounds 0 4 8 12 1 5 9 13 2 6 10 14 3 7 11 15
152. 152. @adam_englander Even Rounds 0 4 8 12 1 5 9 13 2 6 10 14 3 7 11 15
153. 153. @adam_englander Even Rounds 0 4 8 12 1 5 9 13 2 6 10 14 3 7 11 15
154. 154. @adam_englander Even Rounds 0 4 8 12 1 5 9 13 2 6 10 14 3 7 11 15
155. 155. @adam_englander Round Manipulation a ⊞= b; d ⊕= a; a <<< 16 c ⊞= d; b ⊕=c; b<<< 12 a ⊞= b; d ⊕= a; d<<< 8 c ⊞= d; b ⊕=c; b<<< 78
156. 156. @adam_englander Round Manipulation a ⊞= b; d ⊕= a; a <<< 16 c ⊞= d; b ⊕=c; b<<< 12 a ⊞= b; d ⊕= a; d<<< 8 c ⊞= d; b ⊕=c; b<<< 78
157. 157. @adam_englander Round Manipulation a ⊞= b; d ⊕= a; a <<< 16 c ⊞= d; b ⊕=c; b<<< 12 a ⊞= b; d ⊕= a; d<<< 8 c ⊞= d; b ⊕=c; b<<< 78
158. 158. @adam_englander Round Manipulation a ⊞= b; d ⊕= a; a <<< 16 c ⊞= d; b ⊕=c; b<<< 12 a ⊞= b; d ⊕= a; d<<< 8 c ⊞= d; b ⊕=c; b<<< 78
159. 159. @adam_englander Round Manipulation a ⊞= b; d ⊕= a; a <<< 16 c ⊞= d; b ⊕=c; b<<< 12 a ⊞= b; d ⊕= a; d<<< 8 c ⊞= d; b ⊕=c; b<<< 78
160. 160. @adam_englander Round Manipulation a ⊞= b; d ⊕= a; a <<< 16 c ⊞= d; b ⊕=c; b<<< 12 a ⊞= b; d ⊕= a; d<<< 8 c ⊞= d; b ⊕=c; b<<< 78
161. 161. @adam_englander Round Manipulation a ⊞= b; d ⊕= a; d<<< 16 c ⊞= d; b ⊕=c; b<<< 12 a ⊞= b; d ⊕= a; d<<< 8 c ⊞= d; b ⊕=c; b<<< 78
162. 162. @adam_englander Round Manipulation a ⊞= b; d ⊕= a; a <<< 16 c ⊞= d; b ⊕=c; b<<< 12 a ⊞= b; d ⊕= a; d<<< 8 c ⊞= d; b ⊕=c; b<<< 78
163. 163. @adam_englander X hits the spot
164. 164. @adam_englander Which one should I use?
165. 165. @adam_englander XChaCha RSA AES-GCM
167. 167. @adam_englander Msg block 1 Msg block 2 Msg block n XForm block 1 XForm block 2 XForm block n Static IV Compr Result Compr Result Compr Result Hash Compression Transformation F I N Merkle–Damgård MD5/SHA1/SHA2
168. 168. @adam_englander Msg block 1 Msg block 2 Msg block n XForm block 1 XForm block 2 XForm block n Static IV Compr Result Compr Result Compr Result Hash Compression Transformation F I N Merkle–Damgård MD5/SHA1/SHA2
169. 169. @adam_englander Msg block 1 Msg block 2 Msg block n XForm block 1 XForm block 2 XForm block n Static IV Compr Result Compr Result Compr Result Hash Compression Transformation F I N Merkle–Damgård MD5/SHA1/SHA2
170. 170. @adam_englander Msg block 1 Msg block 2 Msg block n XForm block 1 XForm block 2 XForm block n Static IV Compr Result Compr Result Compr Result Hash Compression F I N Merkle–Damgård MD5/SHA1/SHA2 Transformation
171. 171. @adam_englander Msg block 1 Msg block 2 Msg block n XForm block 1 XForm block 2 XForm block n Static IV Compr Result Compr Result Compr Result Hash Compression F I N Merkle–Damgård MD5/SHA1/SHA2 Transformation
172. 172. @adam_englander Msg block 1 Msg block 2 Msg block n XForm block 1 XForm block 2 XForm block n Static IV Compr Result Compr Result Compr Result Hash Compression F I N Merkle–Damgård MD5/SHA1/SHA2 Transformation
173. 173. @adam_englander Msg block 1 Msg block 2 Msg block n XForm block 1 XForm block 2 XForm block n Static IV Compr Result Compr Result Compr Result Hash Compression F I N Merkle–Damgård MD5/SHA1/SHA2 Transformation
174. 174. @adam_englander Msg block 1 Msg block 2 Msg block n XForm block 1 XForm block 2 XForm block n Static IV Compr Result Compr Result Compr Result Hash Compression F I N Merkle–Damgård MD5/SHA1/SHA2 Transformation
175. 175. @adam_englander If they’re all basically the same, how do I pick one to use?
177. 177. @adam_englander Hash Collision Speed SHA1 160 2^80 909 SHA2 512 2^256 623 SHA3 512 2^256 198 Blake2 512 2^256 947
178. 178. @adam_englander Hash Collision Speed SHA1 160 2^80 909 SHA2 512 2^256 623 SHA3 512 2^256 198 Blake2 512 2^256 947
179. 179. @adam_englander Hash Collision Speed SHA1 160 2^80 909 SHA2 512 2^256 623 SHA3 512 2^256 198 Blake2 512 2^256 947
180. 180. @adam_englander Hash Collision Speed SHA1 160 2^80 909 SHA2 512 2^256 623 SHA3 512 2^256 198 Blake2 512 2^256 947
181. 181. @adam_englander Hash Collision Speed SHA1 160 2^80 909 SHA2 512 2^256 623 SHA3 512 2^256 198 Blake2 512 2^256 947
182. 182. @adam_englander Hash Collision Speed SHA1 160 2^80 909 SHA2 512 2^256 623 SHA3 512 2^256 198 Blake2 512 2^256 947
183. 183. @adam_englander Hash Collision Speed SHA1 160 2^80 909 SHA2 512 2^256 623 SHA3 512 2^256 198 Blake2 512 2^256 947
184. 184. @adam_englander Hash Collision Speed SHA-256 256 2^128 413 SHA-512 512 2^256 623 SHA3 256 2^128 367 Blake2 512 2^256 947
185. 185. @adam_englander Hash Collision Speed SHA-256 256 2^128 413 SHA-512 512 2^256 623 SHA3 256 2^128 367 Blake2 512 2^256 947
186. 186. @adam_englander 2.4814314e59 Years/collision 2^256 Hash/collision ➗4.6663425e15 Hash/year
187. 187. @adam_englander 248,143,142,594,689,942,762, 604,727,382,715,494,744,052, 723,660,212,605,567,331 years
188. 188. @adam_englander 248,143,142,594,689,942,762, 604,727,382,715,494,744,052, 723,660,212,605,567 years
189. 189. @adam_englander 248,143,142,594,689,942,762, 604,727,382,715,494,744,052, 723,660,212,605 years
190. 190. @adam_englander Hash Collision Speed SHA-256 256 2^128 413 SHA-512 512 2^256 623 SHA3 256 2^128 367 Blake2 512 2^256 947
191. 191. @adam_englander Blake 2b SHA2-512
193. 193. @adam_englander Key SALT SALT Derivation D(1) D(1) Derivation D(2) SALTD(n-1) Derivation Hash
194. 194. @adam_englander Key SALT SALT Derivation D(1) D(1) Derivation D(2) SALTD(n-1) Derivation Hash
195. 195. @adam_englander Key SALT SALT Derivation D(1) D(1) Derivation D(2) SALTD(n-1) Derivation Hash
196. 196. @adam_englander Key SALT SALT Derivation D(1) D(1) Derivation D(2) SALTD(n-1) Derivation Hash
197. 197. @adam_englander Key SALT SALT Derivation D(1) D(1) Derivation D(2) SALTD(n-1) Derivation Hash
198. 198. @adam_englander Key SALT SALT Derivation D(1) D(1) Derivation D(2) SALTD(n-1) Derivation Hash
199. 199. @adam_englander Key SALT SALT Derivation D(1) D(1) Derivation D(2) SALTD(n-1) Derivation Hash
201. 201. @adam_englander Modular Crypt Format \$<identiﬁer>\$<content>
208. 208. @adam_englander PHC Format \$<id>[\$<param>=<value> (,<param>=<value>)*][\$<salt>[\$<hash>]]
209. 209. @adam_englander PHC Format \$<id>[\$<param>=<value> (,<param>=<value>)*][\$<salt>[\$<hash>]]
210. 210. @adam_englander scrypt \$scrypt\$ln=16,r=8,p=1\$aM15713r3Xsvxmi31lqr1Q\$ nFNh2CVHVjNldFVKDHDlm4CmdRSCdEmsjjJxD+iCs5E
211. 211. @adam_englander scrypt \$scrypt\$ln=16,r=8,p=1\$aM15713r3Xsvxmi31lqr1Q\$ nFNh2CVHVjNldFVKDHDlm4CmdRSCdEmsjjJxD+iCs5E
212. 212. @adam_englander scrypt \$scrypt\$ln=16,r=8,p=1\$aM15713r3Xsvxmi31lqr1Q\$ nFNh2CVHVjNldFVKDHDlm4CmdRSCdEmsjjJxD+iCs5E
213. 213. @adam_englander scrypt \$scrypt\$ln=16,r=8,p=1\$aM15713r3Xsvxmi31lqr1Q\$ nFNh2CVHVjNldFVKDHDlm4CmdRSCdEmsjjJxD+iCs5E
214. 214. @adam_englander scrypt \$scrypt\$ln=16,r=8,p=1\$aM15713r3Xsvxmi31lqr1Q\$ nFNh2CVHVjNldFVKDHDlm4CmdRSCdEmsjjJxD+iCs5E
215. 215. @adam_englander Argon2i \$argon2i\$v=19\$m=1024,t=2,p=2\$TmxLemFoVnZFaEJuT1NyYg\$ 4j2ZFDn1fVS70ZExmlJ33rXOinafcmXrp6A6grHEPkI
216. 216. @adam_englander Argon2i \$argon2i\$v=19\$m=1024,t=2,p=2\$TmxLemFoVnZFaEJuT1NyYg\$ 4j2ZFDn1fVS70ZExmlJ33rXOinafcmXrp6A6grHEPkI
217. 217. @adam_englander Argon2i \$argon2i\$v=19\$m=1024,t=2,p=2\$TmxLemFoVnZFaEJuT1NyYg\$ 4j2ZFDn1fVS70ZExmlJ33rXOinafcmXrp6A6grHEPkI
218. 218. @adam_englander Argon2i \$argon2i\$v=19\$m=1024,t=2,p=2\$TmxLemFoVnZFaEJuT1NyYg\$ 4j2ZFDn1fVS70ZExmlJ33rXOinafcmXrp6A6grHEPkI
219. 219. @adam_englander Argon2i \$argon2i\$v=19\$m=1024,t=2,p=2\$TmxLemFoVnZFaEJuT1NyYg\$ 4j2ZFDn1fVS70ZExmlJ33rXOinafcmXrp6A6grHEPkI
220. 220. @adam_englander Which KDF should I use?
221. 221. @adam_englander MCF Function CPU Memory PBKDF2 No HMAC-SHA No No bcrypt Yes blowﬁsh No No scrypt Yes Salsa Yes No Argon2 Yes Blake2 Yes Yes
222. 222. @adam_englander MCF Function CPU Memory PBKDF2 No HMAC-SHA No No bcrypt Yes blowﬁsh No No scrypt Yes Salsa Yes No Argon2 Yes Blake2 Yes Yes
223. 223. @adam_englander MCF Function CPU Memory PBKDF2 No HMAC-SHA No No bcrypt Yes blowﬁsh No No scrypt Yes Salsa Yes No Argon2 Yes Blake2 Yes Yes
224. 224. @adam_englander MCF Function CPU Memory PBKDF2 No HMAC-SHA No No bcrypt Yes blowﬁsh No No scrypt Yes Salsa Yes No Argon2 Yes Blake2 Yes Yes
225. 225. @adam_englander MCF Function CPU Memory PmKDF2 No HMAC-SHA No No mcrypt Yes mlowﬁsh No No scrypt Yes Salsa Yes No Argon2 Yes Blake2 Yes Yes
226. 226. @adam_englander Argon2 scrypt bcrypt
228. 228. @adam_englander What settings should I use?
229. 229. @adam_englander Turn it up as high as you can!
240. 240. @adam_englander Building the Signature Padded Inner Key Message Hash Func Inner Hash Hash Func Signature Padded Outer Key Inner Hash
241. 241. @adam_englander Building the Signature Padded Inner Key Message Hash Func Inner Hash Hash Func Signature Padded Outer Key Inner Hash
242. 242. @adam_englander Building the Signature Padded Inner Key Message Hash Func Inner Hash Hash Func Signature Padded Outer Key Inner Hash
243. 243. @adam_englander Building the Signature Padded Inner Key Message Hash Func Inner Hash Hash Func Signature Padded Outer Key Inner Hash
244. 244. @adam_englander Building the Signature Padded Inner Key Message Hash Func Inner Hash Hash Func Signature Padded Outer Key Inner Hash
245. 245. @adam_englander Building the Signature Padded Inner Key Message Hash Func Inner Hash Hash Func Signature Padded Outer Key Inner Hash
246. 246. @adam_englander Building the Signature Padded Inner Key Message Hash Func Inner Hash Hash Func Signature Padded Outer Key Inner Hash
247. 247. @adam_englander Building the Signature Padded Inner Key Message Hash Func Inner Hash Hash Func Signature Padded Outer Key Inner Hash
249. 249. @adam_englander RSA Signing Message Hash Func Signature Private Key Hashed Message Encrypt
250. 250. @adam_englander RSA Signing Message Hash Func Signature Private Key Message Digest Encrypt
251. 251. @adam_englander RSA Signing Message Hash Func Signature Private Key Message Digest Encrypt
252. 252. @adam_englander RSA Signature Veriﬁcation Message Hash Func Signature Public Key Message Digest Decrypt Decrypted Message Compare
253. 253. @adam_englander RSA Signature Veriﬁcation Message Hash Func Signature Public Key Message Digest Decrypt Decrypted Message Compare
254. 254. @adam_englander RSA Signature Veriﬁcation Message Hash Func Signature Public Key Message Digest Decrypt Decrypted Message Compare
255. 255. @adam_englander RSA Signature Veriﬁcation Message Hash Func Signature Public Key Message Digest Decrypt Decrypted Message Compare
257. 257. @adam_englander DSA Signing Message Hash Func Signature Private Key Message Digest Sign Nonce Gen Nonce
258. 258. @adam_englander DSA Signing Message Hash Func Signature Private Key Message Digest Sign Nonce Gen Nonce
259. 259. @adam_englander DSA Signing Message Hash Func Signature Private Key Message Digest Sign Nonce Gen Nonce
260. 260. @adam_englander DSA Signing Message Hash Func Signature Private Key Message Digest Sign Nonce Gen Nonce
261. 261. @adam_englander DSA Signature Veriﬁcation Message Hash Func Signature Public Key Hashed Message Reverse Nonce Nonce? Compare
262. 262. @adam_englander DSA Signature Veriﬁcation Message Hash Func Signature Public Key Message Digest Reverse Nonce Nonce? Compare
263. 263. @adam_englander DSA Signature Veriﬁcation Message Hash Func Signature Public Key Message Digest Reverse Nonce Nonce? Compare
264. 264. @adam_englander DSA Signature Veriﬁcation Message Hash Func Signature Public Key Message Digest Reverse Nonce Nonce? Compare
268. 268. @adam_englander Type Symmetric Hash Security HMAC Yes SHA3-512 k RSA No SHA2-512 k/12.8 ECDSA No SHA2-512 k/2 EdDSA No Blake k/2
269. 269. @adam_englander Type Symmetric Hash Security HMAC Yes SHA3-512 k RSA No SHA2-512 k/12.8 ECDSA No SHA2-512 k/2 EdDSA No Blake k/2
270. 270. @adam_englander Type Symmetric Hash Security HMAC Yes SHA3-512 512b RSA No SHA2-512 k/12.8 ECDSA No SHA2-512 k/2 EdDSA No Blake k/2
271. 271. @adam_englander Type Symmetric Hash Security HMAC Yes SHA3-512 512b RSA No SHA2-512 k/12.8 ECDSA No SHA2-512 k/2 EdDSA No Blake k/2
272. 272. @adam_englander Type Symmetric Hash Security HMAC Yes SHA3-512 512b RSA No SHA2-512 k/12.8 ECDSA No SHA2-512 k/2 EdDSA No Blake k/2
273. 273. @adam_englander Type Symmetric Hash Security HMAC Yes SHA3-512 512b RSA No SHA2-512 k/12.8 ECDSA No SHA2-512 k/2 EdDSA No Blake k/2
274. 274. @adam_englander Which should I use?
• #### Konzman000

Aug. 29, 2019

Cryptography is the invisible layer protecting everything around us. As software engineers, we are required to have some understanding of cryptography. Most of us only have a cursory understanding. Let’s dive deep into algorithms and modes for encryption, digital signatures, hashing, and key derivation. To get the most from this presentation, it is expected that you have a basic understanding of cryptography.

Total views

220

On Slideshare

0

From embeds

0

Number of embeds

0

11

Shares

0