Skip to content

Commit

Permalink
Add sections to signature slide, tweak presentation script (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
marekkirejczyk committed Jun 20, 2023
1 parent 3162f7d commit 062ab68
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 8 deletions.
14 changes: 11 additions & 3 deletions script/presentation
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
#!/bin/sh

rm -fr elliptic_curves EllipticCurves
python -m manim --save_sections zkmarek/video/main.py -qk &&
# manim_editor --quick_present_export media/videos/main/1080p60/sections/EllipticCurves.json &&
manim_editor --quick_present_export media/videos/main/2160p60/sections/EllipticCurves.json &&
if [ "$1" = "-qk" ]; then
res="2160p60"
elif [ "$1" = "-ql" ]; then
res="480p15"
else
res="1080p60"
fi

python -m manim --save_sections zkmarek/video/main.py $1
manim_editor --quick_present_export media/videos/main/$res/sections/EllipticCurves.json &&
python -m http.server 8000 --directory EllipticCurves
30 changes: 25 additions & 5 deletions zkmarek/video/slides/ec/signature.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ def __init__(self):

def construct(self):
self.title = "Signature"
self.sender_label = Text("Sender")
self.receiver_label = Text("Receiver")
self.sender_label = Text("Signatory")
self.receiver_label = Text("Verifier")

def fade_in_board(self, scene):
self.sender_label.move_to(scene.camera.frame_width / 4 * LEFT)
Expand Down Expand Up @@ -83,17 +83,28 @@ def animate_in(self, scene):
"⎘", "s = (msg + r * K_{Priv})*secret^{-1} \mod n", GREEN
).next_to(msg_box3, DOWN, buff=0.5)

self.new_subsection(scene, "Introduce keys")
scene.play(FadeIn(key_box1))
self.new_subsection(scene, "Introduce message")
scene.play(FadeIn(msg_box1))
self.new_subsection(scene, "Introduce signature")
signature.animate_in(scene)
self.new_subsection(scene, "Message is hash")
scene.play(ReplacementTransform(msg_box1, msg_box2))
self.new_subsection(scene, "Message is msg")
scene.play(ReplacementTransform(msg_box2, msg_box3))
self.new_subsection(scene, "What are keys")
scene.play(ReplacementTransform(key_box1, key_box2))
self.new_subsection(scene, "What is signature")
scene.play(ReplacementTransform(signature, signature2))
self.new_subsection(scene, "Introduce R")
scene.play(ReplacementTransform(signature2, signature3))
self.new_subsection(scene, "Introduce r")
scene.play(ReplacementTransform(signature3, signature4))
self.new_subsection(scene, "Introduce s")
scene.play(ReplacementTransform(signature4, signature5))

self.new_subsection(scene, "From sender to receiver")
ver_key_box = EquationBoxWithIcons.create(
"⚿", "K_{Pub} = k \cdot G", GREEN
).align_to(key_box2, DOWN)
Expand All @@ -114,6 +125,8 @@ def animate_in(self, scene):
ver_msg_box, DOWN, buff=0.5
))


self.new_subsection(scene, "Introduce U and V")
equation_box = EquationBox(
"{{U}} = msg * s^{-1} \mod n",
"{{V}} = r * s^{-1} \mod n",
Expand All @@ -122,13 +135,16 @@ def animate_in(self, scene):
)
scene.play(FadeIn(equation_box))

self.new_subsection(scene, "Introduce C")
c_box = EquationBox(
"C = {{U}} \cdot G + {{V}} \cdot K_{Pub}",
"C_x \mod n \stackrel{?}{=} r"
).next_to(
equation_box, DOWN, buff=0.5
)
scene.play(FadeIn(c_box))

self.new_subsection(scene, "Substitute U and V")
scene.play(Circumscribe(equation_box[0][0]))
scene.play(Circumscribe(c_box[0][1]))
scene.play(Circumscribe(equation_box[1][0]))
Expand All @@ -142,21 +158,22 @@ def animate_in(self, scene):
)

scene.play(ReplacementTransform(c_box, c_box2))

self.new_subsection(scene, "Extract common factor")
scene.play(Circumscribe(c_box2[0][1]))
scene.play(Circumscribe(c_box2[0][5]))
scene.play(Circumscribe(c_box2[0][3]))
scene.play(Circumscribe(c_box2[0][7]))

c_box3 = EquationBox(
"C = {{s^{-1} \cdot G}} (msg + r * K_{Priv})",
"C_x \mod n \stackrel{?}{=} r"
).next_to(
equation_box, DOWN, buff=0.5
)

scene.play(ReplacementTransform(c_box2, c_box3))
scene.play(Circumscribe(c_box3[0][1]))

self.new_subsection(scene, "Calculate inverse of s")
scene.play(Circumscribe(c_box3[0][1]))
scene.play(Indicate(ver_signature[3]))

ver_signature2 = EquationBoxWithIcons.create(
Expand All @@ -165,6 +182,7 @@ def animate_in(self, scene):
).next_to(ver_msg_box, DOWN, buff=0.5)
scene.play(ReplacementTransform(ver_signature, ver_signature2))

self.new_subsection(scene, "Substitute inverse of s")
c_box4 = EquationBox(
"C = G \cdot secret * {{(msg + r * K_{Priv})^{-1}}}"
" * {{(msg + r * K_{Priv})}}",
Expand All @@ -181,6 +199,7 @@ def animate_in(self, scene):
ReplacementTransform(c_box3, c_box4),
ReplacementTransform(self.h_line, h_line2))

self.new_subsection(scene, "Cancel s with inverse of s")
strike1 = StrikeLine(c_box4[0][1])
scene.play(Write(strike1))

Expand All @@ -203,6 +222,7 @@ def animate_in(self, scene):
FadeOut(strike1),
FadeOut(strike2))

self.new_subsection(scene, "Summary")
scene.play(Indicate(c_box5[0]))
scene.play(Indicate(signature5[3]))
scene.play(Indicate(c_box5[1]))
Expand Down

0 comments on commit 062ab68

Please sign in to comment.