-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathencryption.html
3049 lines (2954 loc) · 129 KB
/
encryption.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en"><head>
<script src="quarto_files/clipboard/clipboard.min.js"></script>
<script src="quarto_files/quarto-html/tabby.min.js"></script>
<script src="quarto_files/quarto-html/popper.min.js"></script>
<script src="quarto_files/quarto-html/tippy.umd.min.js"></script>
<link href="quarto_files/quarto-html/tippy.css" rel="stylesheet">
<link href="quarto_files/quarto-html/light-border.css" rel="stylesheet">
<link href="quarto_files/quarto-html/quarto-syntax-highlighting-dark-8ea72dc5fed832574809a9c94082fbbb.css" rel="stylesheet" id="quarto-text-highlighting-styles"><meta charset="utf-8">
<meta name="generator" content="quarto-1.6.40">
<title>Encryption</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
<link rel="stylesheet" href="quarto_files/revealjs/dist/reset.css">
<link rel="stylesheet" href="quarto_files/revealjs/dist/reveal.css">
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
div.columns{display: flex; gap: min(4vw, 1.5em);}
div.column{flex: auto; overflow-x: auto;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
ul.task-list li input[type="checkbox"] {
width: 0.8em;
margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */
vertical-align: middle;
}
</style>
<link rel="stylesheet" href="quarto_files/revealjs/dist/theme/quarto-5b48f34d633aed70c74c672477009ffc.css">
<link rel="stylesheet" href="ccc.css">
<link href="quarto_files/revealjs/plugin/quarto-line-highlight/line-highlight.css" rel="stylesheet">
<link href="quarto_files/revealjs/plugin/reveal-menu/menu.css" rel="stylesheet">
<link href="quarto_files/revealjs/plugin/reveal-menu/quarto-menu.css" rel="stylesheet">
<link href="quarto_files/revealjs/plugin/reveal-chalkboard/font-awesome/css/all.css" rel="stylesheet">
<link href="quarto_files/revealjs/plugin/reveal-chalkboard/style.css" rel="stylesheet">
<link href="quarto_files/revealjs/plugin/quarto-support/footer.css" rel="stylesheet">
<style type="text/css">
.reveal div.sourceCode {
margin: 0;
overflow: auto;
}
.reveal div.hanging-indent {
margin-left: 1em;
text-indent: -1em;
}
.reveal .slide:not(.center) {
height: 100%;
}
.reveal .slide.scrollable {
overflow-y: auto;
}
.reveal .footnotes {
height: 100%;
overflow-y: auto;
}
.reveal .slide .absolute {
position: absolute;
display: block;
}
.reveal .footnotes ol {
counter-reset: ol;
list-style-type: none;
margin-left: 0;
}
.reveal .footnotes ol li:before {
counter-increment: ol;
content: counter(ol) ". ";
}
.reveal .footnotes ol li > p:first-child {
display: inline-block;
}
.reveal .slide ul,
.reveal .slide ol {
margin-bottom: 0.5em;
}
.reveal .slide ul li,
.reveal .slide ol li {
margin-top: 0.4em;
margin-bottom: 0.2em;
}
.reveal .slide ul[role="tablist"] li {
margin-bottom: 0;
}
.reveal .slide ul li > *:first-child,
.reveal .slide ol li > *:first-child {
margin-block-start: 0;
}
.reveal .slide ul li > *:last-child,
.reveal .slide ol li > *:last-child {
margin-block-end: 0;
}
.reveal .slide .columns:nth-child(3) {
margin-block-start: 0.8em;
}
.reveal blockquote {
box-shadow: none;
}
.reveal .tippy-content>* {
margin-top: 0.2em;
margin-bottom: 0.7em;
}
.reveal .tippy-content>*:last-child {
margin-bottom: 0.2em;
}
.reveal .slide > img.stretch.quarto-figure-center,
.reveal .slide > img.r-stretch.quarto-figure-center {
display: block;
margin-left: auto;
margin-right: auto;
}
.reveal .slide > img.stretch.quarto-figure-left,
.reveal .slide > img.r-stretch.quarto-figure-left {
display: block;
margin-left: 0;
margin-right: auto;
}
.reveal .slide > img.stretch.quarto-figure-right,
.reveal .slide > img.r-stretch.quarto-figure-right {
display: block;
margin-left: auto;
margin-right: 0;
}
</style>
</head>
<body class="quarto-dark">
<div class="reveal">
<div class="slides">
<section id="title-slide" class="quarto-title-block center">
<p class="titlep"> </p>
<div class="orangetitle">
<h1 class="title" style="color:white !important">CS 4970</h1>
<h2 class="subtitle" style="color:white !important">Cryptocurrency</h2>
<h2 class="subtitle" style="color:white !important">Encryption</h2>
</div>
<p class="titlep"> </p>
<p class="titlep"> </p>
<div class="titlesmall"><p>
<a href="https://www.cs.virginia.edu/~asb">Aaron Bloomfield</a> ([email protected])<br>
<a href="https://github.com/aaronbloomfield/ccc">@github</a> | <a href="index.html">↑</a> | <a href="?print-pdf"><img class="print" width="20" src="images/print-icon.svg" style="top:0px;vertical-align:middle;background-color:transparent;display:inline;width:30px;height:30px"></a>
</p></div>
<p class="titlep"> </p>
</section><section id="TOC">
<nav role="doc-toc">
<h2 id="toc-title">Contents</h2>
<ul>
<li><a href="#/overview" id="/toc-overview">Overview</a></li>
<li><a href="#/elliptic-curves" id="/toc-elliptic-curves">Elliptic Curves</a></li>
<li><a href="#/finite-fields" id="/toc-finite-fields">Finite Fields</a></li>
<li><a href="#/ecdsa" id="/toc-ecdsa">ECDSA</a></li>
<li><a href="#/randomness" id="/toc-randomness">Randomness</a></li>
<li><a href="#/hashing" id="/toc-hashing">Hashing</a></li>
<li><a href="#/applied-cryptography" id="/toc-applied-cryptography">Applied Cryptography</a></li>
</ul>
</nav>
</section>
<section>
<section id="overview" class="title-slide slide level1 center">
<h1>Overview</h1>
</section>
<section id="content-coverage" class="slide level2">
<h2>Content coverage</h2>
<ul>
<li>You may have seen some of this material in the <a href="https://aaronbloomfield.github.io/ics/slides/encryption.html#/">encryption slide set</a> from CS 3710: Introduction to Cybersecurity
<ul>
<li>But only this first column of slides is the same (a dozen or so slides)</li>
</ul></li>
<li>If you didn’t see that material, that’s fine
<ul>
<li>We’ll go over all of it</li>
</ul></li>
</ul>
</section>
<section id="codes-versus-ciphers" class="slide level2">
<h2>Codes versus Ciphers</h2>
<ul>
<li>Codes change the meaning of words, ciphers encrypt them</li>
<li>Coded messages:
<ul>
<li>“The light is on in the attic”</li>
<li>“The condor has left the nest”</li>
</ul></li>
<li>Cipher’ed messages:
<ul>
<li>wkh txlfn eurzq ira mxpsv ryhu wkh odcb grj</li>
<li>wecrl teerd soeef eaoca ivden</li>
</ul></li>
<li><a href="http://en.wikipedia.org/wiki/Cipher#Ciphers_versus_codes">Reference</a></li>
</ul>
</section>
<section id="block-ciphers-vs.-stream-ciphers" class="slide level2">
<h2>Block-ciphers vs. stream ciphers</h2>
<ul>
<li>Block ciphers require a block of text (examples: 256 bits (32 bytes), 1 Kb, etc.)
<ul>
<li><a href="http://en.wikipedia.org/wiki/Block_cipher">Reference</a></li>
</ul></li>
<li>Stream ciphers, a.k.a. character ciphers, encrypt data as it is provided, character-by-character
<ul>
<li>I prefer the name ‘character cipher’ over ‘stream cipher’</li>
<li><a href="http://en.wikipedia.org/wiki/Stream_cipher">Reference</a></li>
</ul></li>
</ul>
</section>
<section id="one-time-pad-otp" class="slide level2">
<h2>One-time pad (OTP)</h2>
<ul>
<li>A substitution cipher</li>
<li>Take a <em>random</em> string that is as long as the plain text you want encrypt
<ul>
<li>Use modular arithmetic (or XOR, or Vigenere) to determine the encrypted version</li>
<li>Plain text: helloworld</li>
<li>One-time pad: zdxwhtsvtv</li>
<li>Encrypted: hijiwqhnfz</li>
</ul></li>
<li><a href="http://en.wikipedia.org/wiki/One-time_pad">Reference</a></li>
</ul>
</section>
<section id="one-time-pad-otp-analysis" class="slide level2">
<h2>One-time pad (OTP) analysis</h2>
<ul>
<li>
Pros:
</li>
<ul>
<li>Proven to be perfectly secure if:
<ul>
<li>the pad is truly random</li>
<li>the pad is only used once</li>
<li>the pad is kept secret</li>
</ul></li>
<li>This, it is the ONLY cryptosystem with perfect secrecy</li>
<li>It can be performed by hand</li>
</ul>
<li class="fragment">
<p>Cons:</p>
<ul>
<li>Good for short messages; it’s hard to transport large pads (i.e. network communication)</li>
<li>Does not provide message authentication</li>
<li>How do you get the pad to the recipient?</li>
<li>Can never use it twice</li>
</ul>
</li>
</ul>
</section>
<section id="re-using-a-one-time-pad" class="slide level2">
<h2>Re-using a one-time pad</h2>
<table class="transparent">
<tbody><tr>
<td>
Use an OTP:
</td>
<td>
<img alt="re-using OTP" class="nopad" style="vertical-align:middle;display:initial" src="images/encryption/otp/otp-1.png"> ⊕ <img alt="re-using OTP" class="nopad" style="vertical-align:middle;display:initial;border:2px solid green" src="images/encryption/otp/otp.png"> = <img alt="re-using OTP" class="nopad" style="vertical-align:middle;display:initial;border:2px solid red" src="images/encryption/otp/otp-1e.png">
</td>
</tr>
<tr class="fragment">
<td>
Re-use the<br>same OTP:
</td>
<td>
<img alt="re-using OTP" class="nopad" style="vertical-align:middle;display:initial" src="images/encryption/otp/otp-2.png"> ⊕ <img alt="re-using OTP" class="nopad" style="vertical-align:middle;display:initial;border:2px solid green" src="images/encryption/otp/otp.png"> = <img alt="re-using OTP" class="nopad" style="vertical-align:middle;display:initial;border:2px solid blue" src="images/encryption/otp/otp-2e.png">
</td>
</tr>
<tr class="fragment">
<td>
Extract<br>the images:
</td>
<td>
<img alt="re-using OTP" class="nopad" style="vertical-align:middle;display:initial;border:2px solid red" src="images/encryption/otp/otp-1e.png"> ⊕ <img alt="re-using OTP" class="nopad" style="vertical-align:middle;display:initial;border:2px solid blue" src="images/encryption/otp/otp-2e.png"> = <img alt="re-using OTP" class="nopad" style="vertical-align:middle;display:initial" src="images/encryption/otp/otp-ans.png">
</td>
</tr>
</tbody></table>
<p>
This example from <a href="https://crypto.stackexchange.com/questions/59/taking-advantage-of-one-time-pad-key-reuse">StackExchange</a>
</p>
</section>
<section id="data-encryption-standard-des" class="slide level2">
<h2>Data Encryption Standard (<a href="http://en.wikipedia.org/wiki/Data_Encryption_Standard">DES</a>)</h2>
<ul>
<li>A secret key encryption/decryption block cipher
<ul>
<li>64 bits, but only 56 are usable</li>
</ul></li>
<li>Lots of bit-shifting in rounds to encrypt/decrypt a message</li>
<li>Susceptible to brute force attacks (<span class="math inline">\(2^{56} = 7 \ast 10^{16}\)</span> keys)</li>
<li>Solution: use DES three times => “Triple DES”
<ul>
<li>Use 168 bit keys: three 56 bit keys, and encrypt the message three times, once with each key</li>
</ul></li>
<li>NIST considers it secure through 2030</li>
</ul>
</section>
<section id="advanced-encryption-standard-aes" class="slide level2">
<h2><span class="r-fit-text">Advanced Encryption Standard (AES)</span></h2>
<ul>
<li>The successor to DES</li>
<li>Has three possible key lengths: 128, 192, and 256</li>
<li>NSA approved this standard, and kept the process open</li>
<li>Also lots of bit-shifting in rounds to encrypt/decrypt a message</li>
<li>Many worry about the security of the standard
<ul>
<li>… that somebody may figure a way to crack it mathematically, in particular</li>
</ul></li>
<li><a href="http://en.wikipedia.org/wiki/Advanced_Encryption_Standard">Reference</a></li>
</ul>
</section>
<section id="public-key-cryptography" class="slide level2">
<h2>Public key cryptography</h2>
<ul>
<li>Everybody has a key that encrypts and a separate key that decrypts
<ul>
<li>They are not interchangeable!</li>
<li>If one key encrypts a message, the <em>only</em> the other key can decrypt it</li>
</ul></li>
<li>The encryption key is made public</li>
<li>The decryption key is kept private</li>
</ul>
</section>
<section id="public-key-cryptography-1" class="slide level2">
<h2>Public key cryptography</h2>
<ul>
<li>Alice (A) wants to send a message to Bob (B)
<ul>
<li>Alice and Bob already have each other’s public keys</li>
</ul></li>
<li>Alice encrypts message <span class="math inline">\(m_1\)</span> with Bob’s public key <span class="math inline">\(B_{pub}\)</span> to create ciphertext <span class="math inline">\(c_1\)</span>
<ul>
<li>She cannot decrypt <span class="math inline">\(c_1\)</span> with <span class="math inline">\(B_{pub}\)</span>
<ul>
<li>Although she likely has a copy of <span class="math inline">\(m_1\)</span></li>
</ul></li>
</ul></li>
<li>Bob decrypts <span class="math inline">\(c_1\)</span> with his private key <span class="math inline">\(B_{pri}\)</span> to get the original <span class="math inline">\(m_1\)</span></li>
<li>Bob encrypts response message <span class="math inline">\(m_2\)</span> with Alice’s public key <span class="math inline">\(A_{pub}\)</span> to create <span class="math inline">\(c_2\)</span></li>
<li>Alice can decrypt <span class="math inline">\(c_2\)</span> with her private key <span class="math inline">\(A_{pri}\)</span> to get the original <span class="math inline">\(m_2\)</span></li>
</ul>
</section>
<section id="public-key-signatures" class="slide level2">
<h2>Public key signatures</h2>
<ul>
<li>What if Alice wants to publish a message publicly, and prove that it really came from her?</li>
<li>She needs to <em>digitally sign</em> the message:
<ul>
<li>Given message <span class="math inline">\(m\)</span>, compute <span class="math inline">\(h = sha256(m)\)</span> using a known hash function such as SHA-256</li>
<li>Encrypt <span class="math inline">\(h\)</span> with her <em>private</em> key <span class="math inline">\(A_{pri}\)</span> to get signature <span class="math inline">\(s\)</span></li>
<li>Publicly release both the message <span class="math inline">\(m\)</span> and the signature <span class="math inline">\(s\)</span></li>
</ul></li>
</ul>
</section>
<section id="public-key-signatures-1" class="slide level2">
<h2>Public key signatures</h2>
<ul>
<li>Now anybody can verify that it came from her:
<ul>
<li>Given public message <span class="math inline">\(m\)</span>, anybody can take the hash of it: <span class="math inline">\(h' = sha256(m)\)</span></li>
<li>Given the signature <span class="math inline">\(s\)</span>, anybody can decrypt it with Alice’s <em>public</em> key <span class="math inline">\(A_{pub}\)</span> to get the original <span class="math inline">\(h\)</span>
<ul>
<li>Recall that <span class="math inline">\(s\)</span> is the encryption of <span class="math inline">\(h\)</span> using <span class="math inline">\(A_{pri}\)</span></li>
<li>If one key encrypts, then the other can decrypt</li>
</ul></li>
<li>If <span class="math inline">\(h == h'\)</span>, then the original message was signed by Alice’s private key</li>
</ul></li>
</ul>
</section>
<section id="public-key-cryptography-math" class="slide level2">
<h2>Public key cryptography math</h2>
<ul>
<li>Public key cryptography uses some type of mathematical theory…
<ul>
<li>… such as prime numbers, elliptic curves, or discrete logs …</li>
</ul></li>
<li>Where some things are “easy” (read: polynomial time)
<ul>
<li>These are the operations used for key generation, encryption, and decryption</li>
<li>Examples: determining if a number is prime, elliptic point multiplication, discrete exponentiation</li>
</ul></li>
<li>And some things are “hard” (read: exponential time)
<ul>
<li>These are the operations needed to “crack” the encryption</li>
<li>Examples: factoring a large composite number, elliptic point division, discrete logs</li>
</ul></li>
</ul>
</section>
<section id="public-key-cryptography-challenges" class="slide level2">
<h2><span class="r-fit-text">Public key cryptography challenges</span></h2>
<ul>
<li>Ensuring you obtain the correct key (not a malicious fake)</li>
<li>Ensuring somebody “in the middle” doesn’t modify your communications</li>
<li>Speed of key generation</li>
<li>Speed of encryption / decryption</li>
<li>Size of the signatures</li>
</ul>
<!-- ============================================================ -->
</section></section>
<section>
<section id="elliptic-curves" class="title-slide slide level1 center">
<h1>Elliptic Curves</h1>
</section>
<section id="elliptic-curves-1" class="slide level2">
<h2>Elliptic Curves</h2>
<p>Any curve of the form <span class="math inline">\(y^2=x^3+ax+b\)</span></p>
<a href="https://en.wikipedia.org/wiki/Elliptic_curve"><img alt="wikipedia elliptic curve diagram" src="images/encryption/EllipticCurveCatalog.svg" style="background-color:white;padding:10px;border-radius:5px"></a>
<aside data-markdown="" class="notes">
notes…
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside>
</section>
<section id="specific-elliptic-curves" class="slide level2">
<h2>Specific Elliptic Curves</h2>
<ul>
<li>We are going to study curve <a href="http://www.secg.org/sec2-v2.pdf">secp256k1</a>
<ul>
<li>Where <span class="math inline">\(a=0\)</span> and <span class="math inline">\(b=7\)</span>, so the curve formula is <span class="math inline">\(y^2=x^3+7\)</span></li>
</ul></li>
<li>Operations:
<ul>
<li>Elliptic curve point “addition”: <span class="math inline">\(P = Q \oplus R\)</span></li>
<li>Elliptic curve point “multiplication”: <span class="math inline">\(Q = k \otimes P = kP\)</span>
<ul>
<li>We’ll show that <span class="math inline">\(k \otimes P = \sum_{i=1}^{k}P\)</span>
<ul>
<li>That summation is repeated elliptic curve “addition”</li>
</ul></li>
</ul></li>
<li>Note that numerical values are always lower case variables and points are always upper case variables
<aside data-markdown="" class="notes">
notes…
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside></li>
</ul></li>
</ul>
</section>
<section class="slide level2">
<img src="images/encryption/secp256k1/secp256k1-a.svg" alt="image secp256k1-a.svg" class="stretch">
<aside data-markdown="" class="notes">
<ul>
<li>note the scale differs on each axis</li>
<li>it reflects across the horizontal (<span class="math inline">\(x\)</span>) axis due to the <span class="math inline">\(y^2\)</span> part</li>
</ul>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside>
</section>
<section class="slide level2">
<img src="images/encryption/secp256k1/secp256k1-q-zoomed-out.svg" alt="image secp256k1-q-zoomed-out.svg" class="stretch">
<aside data-markdown="" class="notes">
<ul>
<li>just showing it zoomed out</li>
<li>the slope approaches infinity, meaning the line approaches vertical, but not asymptotically</li>
<li>note the different scales – the line is almost vertical at the end</li>
</ul>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside>
</section>
<section class="slide level2">
<img src="images/encryption/secp256k1/secp256k1-r-zoomed-out-with-line.svg" alt="image secp256k1-r-zoomed-out-with-line.svg" class="stretch">
<aside data-markdown="" class="notes">
<ul>
<li>just trying to show the curvature of the curve</li>
</ul>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside>
</section>
<section class="slide level2">
<img src="images/encryption/secp256k1/secp256k1-a.svg" alt="image secp256k1-a.svg" class="stretch">
<aside data-markdown="" class="notes">
<ul>
<li>back to the zoomed-in version</li>
</ul>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside>
</section>
<section class="slide level2">
<img src="images/encryption/secp256k1/secp256k1-b-2points.svg" alt="image secp256k1-b-2points.svg" class="stretch">
<aside data-markdown="" class="notes">
<ul>
<li>arbitrarily picked to allow the math to all work out on the area shown by this slide
<ul>
<li>for each <span class="math inline">\(x\)</span>-value there are two possible <span class="math inline">\(y\)</span> values due to the square root</li>
</ul></li>
<li>in reality, the numbers used are huge: 256 bits
<ul>
<li><span class="math inline">\(2^{256} \approx 1.1*10^{77}\)</span></li>
</ul></li>
</ul>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside>
</section>
<section class="slide level2">
<img src="images/encryption/secp256k1/secp256k1-c-2points-line.svg" alt="image secp256k1-c-2points-line.svg" class="stretch">
<aside data-markdown="" class="notes">
<ul>
<li>given any two points, use basic arithmetic to compute the slope</li>
</ul>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside>
</section>
<section class="slide level2">
<img src="images/encryption/secp256k1/secp256k1-d-3points-line.svg" alt="image secp256k1-d-3points-line.svg" class="stretch">
<aside data-markdown="" class="notes">
<ul>
<li>find the third point where this line intersects the curve
<ul>
<li>in the RARE case it doesn’t, pick new points</li>
<li>that chance is infinitesimally small in practice</li>
</ul></li>
<li>for real numbers, this requires finding a cube root
<ul>
<li>we will be able to compute this with basic arithmetic…</li>
</ul></li>
</ul>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside>
</section>
<section class="slide level2">
<img src="images/encryption/secp256k1/secp256k1-e-4points-line.svg" alt="image secp256k1-e-4points-line.svg" class="stretch">
<aside data-markdown="" class="notes">
<ul>
<li>reflect the point just found across the y-axis</li>
<li>the reflected point, C’, is A+B</li>
<li>this is elliptic point “addition”
<ul>
<li>represented with oplus</li>
</ul></li>
</ul>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside>
</section>
<section class="slide level2">
<img src="images/encryption/secp256k1/secp256k1-f-point-p.svg" alt="image secp256k1-f-point-p.svg" class="stretch">
<aside data-markdown="" class="notes">
<ul>
<li>we can add a point to itself as well</li>
<li>this point P is different than A and B from before</li>
</ul>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside>
</section>
<section class="slide level2">
<img src="images/encryption/secp256k1/secp256k1-g-point-p-tangent.svg" alt="image secp256k1-g-point-p-tangent.svg" class="stretch">
<aside data-markdown="" class="notes">
<ul>
<li>to elliptically add a point to itself, find the tangent of the line…
<ul>
<li>we can do that via the derivative of the curve formula</li>
</ul></li>
</ul>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside>
</section>
<section class="slide level2">
<img src="images/encryption/secp256k1/secp256k1-h-points-pq-tangent.svg" alt="image secp256k1-h-points-pq-tangent.svg" class="stretch">
<aside data-markdown="" class="notes">
<ul>
<li>find the point, Q, where that tangent intersects the curve…</li>
</ul>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside>
</section>
<section class="slide level2">
<img src="images/encryption/secp256k1/secp256k1-i-points-pq-tangent.svg" alt="image secp256k1-i-points-pq-tangent.svg" class="stretch">
<aside data-markdown="" class="notes">
<ul>
<li>then reflect that across the y-axis</li>
<li>this is P+P and also 2*P</li>
<li>but does adding P to itself, say, 4 times equal 4*P?</li>
</ul>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside>
</section>
<section class="slide level2">
<img src="images/encryption/secp256k1/secp256k1-j-to-find-3p.svg" alt="image secp256k1-j-to-find-3p.svg" class="stretch">
<aside data-markdown="" class="notes">
<ul>
<li>here we are adding P to Q
<ul>
<li>or P to P+P</li>
<li>or P to 2*P</li>
</ul></li>
</ul>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside>
</section>
<section class="slide level2">
<img src="images/encryption/secp256k1/secp256k1-k-to-find-3p.svg" alt="image secp256k1-k-to-find-3p.svg" class="stretch">
<aside data-markdown="" class="notes">
<ul>
<li>the line intersects the curve at R</li>
</ul>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside>
</section>
<section class="slide level2">
<img src="images/encryption/secp256k1/secp256k1-l-found-3p.svg" alt="image secp256k1-l-found-3p.svg" class="stretch">
<aside data-markdown="" class="notes">
<ul>
<li>which we reflect across the y-axis</li>
<li>R’ is now P+P+P or 3*P</li>
</ul>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside>
</section>
<section class="slide level2">
<img src="images/encryption/secp256k1/secp256k1-m-showing-found-points.svg" alt="image secp256k1-m-showing-found-points.svg" class="stretch">
<aside data-markdown="" class="notes">
<ul>
<li>The points from the previous slide without all the text</li>
</ul>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside>
</section>
<section class="slide level2">
<img src="images/encryption/secp256k1/secp256k1-n-associative-1.svg" alt="image secp256k1-n-associative-1.svg" class="stretch">
<aside data-markdown="" class="notes">
<ul>
<li>we add P and R’ to get S’</li>
<li>S’ is 4*P or P+P+P+P</li>
<li>we can all agree that adding P to itself 4 times yields S’</li>
</ul>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside>
</section>
<section class="slide level2">
<img src="images/encryption/secp256k1/secp256k1-o-associative-2.svg" alt="image secp256k1-o-associative-2.svg" class="stretch">
<aside data-markdown="" class="notes">
<ul>
<li>we can also add Q’, which is 2*P (or P+P) to itself to yield S’</li>
</ul>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside>
</section>
<section class="slide level2">
<img src="images/encryption/secp256k1/secp256k1-p-associative-3.svg" alt="image secp256k1-p-associative-3.svg" class="stretch">
<aside data-markdown="" class="notes">
<ul>
<li>this means that adding P to itself k times yields k*P</li>
</ul>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside>
</section>
<section class="slide level2">
<img src="images/encryption/secp256k1/secp256k1-q-point-at-infinity.svg" alt="image secp256k1-q-point-at-infinity.svg" class="stretch">
<aside data-markdown="" class="notes">
<ul>
<li>…</li>
</ul>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside>
</section>
<section id="the-point-at-infinity" class="slide level2">
<h2>The Point at Infinity</h2>
<ul>
<li>Represented by the digit 0 or capital O</li>
<li>Considered one of the points “on” the curve</li>
<li>Considered the identity element: <span class="math inline">\(0 \oplus P = P\)</span></li>
<li>And <span class="math inline">\(P \oplus P'=0\)</span></li>
</ul>
</section>
<section id="elliptical-curve-notes" class="slide level2">
<h2>Elliptical Curve notes</h2>
<ul>
<li>Most operations were the standard arithmetic operations on scalars
<ul>
<li>Given the <span class="math inline">\(y=mx+b\)</span> formula and an <span class="math inline">\(x\)</span> value, finding the corresponding <span class="math inline">\(y\)</span> is easy</li>
</ul></li>
<li>The only ones that were not were:
<ol type="1">
<li>Finding the initial points using square roots to determine <span class="math inline">\(y\)</span> from <span class="math inline">\(y^2\)</span></li>
<li>Finding the 3rd root of a cubic equation when the other two roots are known</li>
</ol></li>
<li>We can perform these two with basic arithmetic by:
<ol type="1">
<li>Being given an initial point on the curve</li>
<li>Taking a formulaic shortcut to find the intersection of a line and the curve</li>
</ol></li>
</ul>
</section>
<section id="elliptical-curve-identities" class="slide level2">
<h2>Elliptical Curve Identities</h2>
<ul>
<li>Multiplication
<ul>
<li>Generalized: <span class="math inline">\(\sum_{i=1}^{k} P = k \otimes P\)</span>
<ul>
<li>Note that the summation operation is EC point <span class="math inline">\(\oplus\)</span>, not scalar <span class="math inline">\(+\)</span></li>
</ul></li>
<li>Example: <span class="math inline">\(P \oplus P \oplus P \oplus P = 4 \otimes P\)</span></li>
</ul></li>
<li>Notation
<ul>
<li>Generalized: <span class="math inline">\(k \otimes P = kP\)</span></li>
</ul></li>
</ul>
</section>
<section id="elliptical-curve-identities-1" class="slide level2">
<h2>Elliptical Curve Identities</h2>
<ul>
<li>Distributive property
<ul>
<li>Generalized: <span class="math inline">\((a+b) \otimes P = (a \otimes P) \oplus (b \otimes P)\)</span>
<ul>
<li>Due to the order of operations (<span class="math inline">\(\otimes\)</span> before <span class="math inline">\(\oplus\)</span>), we can rewrite that as:</li>
<li><span class="math inline">\((a+b) \otimes P = a \otimes P \oplus b \otimes P\)</span></li>
</ul></li>
<li>Example: <span class="math inline">\((2+2) \otimes P = (2 \otimes P) \oplus (2 \otimes P) = 2P \oplus 2P = 4P\)</span></li>
</ul></li>
<li>Associative property
<ul>
<li><span class="math inline">\(A \oplus B \oplus C = (A \oplus B) \oplus C = A \oplus (B \oplus C)\)</span></li>
</ul></li>
</ul>
<!-- ============================================================ -->
</section></section>
<section>
<section id="finite-fields" class="title-slide slide level1 center">
<h1>Finite Fields</h1>
</section>
<section id="finite-fields-1" class="slide level2">
<h2>Finite Fields</h2>
<div class="right-float-img">
<p><img data-src="https://upload.wikimedia.org/wikipedia/commons/a/a4/Clock_face_one_hand.png"></p>
</div>
<ul>
<li>A <em>field</em> is just a set of numbers that you can perform the basic arithmetic operations on
<ul>
<li>The real numbers are also a field (but not integers!)</li>
</ul></li>
<li>An integer <a href="https://en.wikipedia.org/wiki/Finite_field">finite field</a>:
<ul>
<li>Is defined by a (tyipcally prime) value <span class="math inline">\(p\)</span></li>
<li>All operations are mod <span class="math inline">\(p\)</span></li>
<li>Thus the possible values are the integers <span class="math inline">\(0\)</span> to <span class="math inline">\(p-1\)</span></li>
<li>Denoted as <span class="math inline">\(Z_p\)</span> (and, sometimes, <span class="math inline">\(F_p\)</span>)</li>
</ul></li>
</ul>
<aside data-markdown="" class="notes">
<ul>
<li>a finite field doesn’t have to have a prime <span class="math inline">\(p\)</span>…
<ul>
<li>a clock is (almost) a finite field with a non-prime <span class="math inline">\(p\)</span></li>
<li><em>almost</em> because it’s 1-12, not 0-11</li>
</ul></li>
<li>but for the elliptic curves, we’ll always use a prime <span class="math inline">\(p\)</span> else the math won’t work right</li>
<li>integers are a ring, not a field, as some operations are not valid therein (7/3, for example)</li>
</ul>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside>
</section>
<section id="finite-field-operations" class="slide level2">
<h2>Finite Field Operations</h2>
<ul>
<li>Operations in <span class="math inline">\(Z_{17}\)</span></li>
<li>Addition: easy – just add the two numbers and mod by <span class="math inline">\(p\)</span>
<ul>
<li><span class="math inline">\(13+25 = 38 \mod 17 = 4\)</span></li>
</ul></li>
<li>Multiplication: easy – just multiply and mod by <span class="math inline">\(p\)</span>
<ul>
<li><span class="math inline">\(6*6 = 36 \mod 17 = 2\)</span></li>
</ul></li>
<li>Exponentiation: easy – just exponentiate and mod by <span class="math inline">\(p\)</span>
<ul>
<li><span class="math inline">\(3^3 = 27 \mod 17 = 10\)</span></li>
<li>There are more efficient ways to do this, not covered here</li>
</ul></li>
</ul>
</section>
<section id="finite-field-subtraction" class="slide level2">