diff --git a/20240418/Zeichen_123.pdf b/20240418/Zeichen_123.pdf new file mode 120000 index 0000000000000000000000000000000000000000..fdbc897227df059cfda790a16555e6e417682116 --- /dev/null +++ b/20240418/Zeichen_123.pdf @@ -0,0 +1 @@ +../common/Zeichen_123.pdf \ No newline at end of file diff --git a/20240418/ad-20240418.pdf b/20240418/ad-20240418.pdf new file mode 100644 index 0000000000000000000000000000000000000000..90154ee1c57ce8154e79b64bebb169bd2d0d5527 Binary files /dev/null and b/20240418/ad-20240418.pdf differ diff --git a/20240418/ad-20240418.tex b/20240418/ad-20240418.tex new file mode 100644 index 0000000000000000000000000000000000000000..f65f5cd804a8c1aac1ea756b6486d350eddd385c --- /dev/null +++ b/20240418/ad-20240418.tex @@ -0,0 +1,317 @@ +% ad-20240418.pdf - Lecture Slides on Algorithms and Data Structures in C/C++ +% Copyright (C) 2018, 2019, 2020, 2021, 2022, 2023, 2024 Peter Gerwinski +% +% This document is free software: you can redistribute it and/or +% modify it either under the terms of the Creative Commons +% Attribution-ShareAlike 3.0 License, or under the terms of the +% GNU General Public License as published by the Free Software +% Foundation, either version 3 of the License, or (at your option) +% any later version. +% +% This document is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this document. If not, see <http://www.gnu.org/licenses/>. +% +% You should have received a copy of the Creative Commons +% Attribution-ShareAlike 3.0 Unported License along with this +% document. If not, see <http://creativecommons.org/licenses/>. + +% README: Mathematische Grundlagen der Kryptographie + +\documentclass[10pt,t]{beamer} + +\usepackage{pgslides} +\usepackage{tikz} +%\usepackage{rotating} + +\newcommand{\underconstruction}{% + \begin{picture}(0,0) + \color{black} + \put(6,-2.2){\makebox(0,0)[b]{\includegraphics[width=1.5cm]{Zeichen_123.pdf}}} + \put(6,-2.5){\makebox(0,0)[t]{\shortstack{Änderungen\\vorbehalten}}} + \end{picture}} + +\title{Algorithmen und Datenstrukturen in C/C++} +\author{Prof.\ Dr.\ rer.\ nat.\ Peter Gerwinski} +\date{18.\ April 2024} + +\begin{document} + +\maketitleframe + +\nosectionnonumber{\inserttitle} + +\begin{frame} + + \shownosectionnonumber + + \begin{itemize} + \item[\textbf{1}] \textbf{Einführung} + \underconstruction + \hfill\makebox(0,0)[br]{\raisebox{2.25ex}{\url{https://gitlab.cvh-server.de/pgerwinski/ad}}} +% \item[\textbf{\color{red}i}] {\color{red}Online-Werkzeuge für Home Office, Lehre\\ +% und Kommunikation mit Unterdrückten} + \item[\textbf{2}] \textbf{Arrays und Zeiger für Fortgeschrittene} + \item[\textbf{3}] \textbf{Langzahl-Arithmetik} + \item[\textbf{4}] \textbf{Kryptographie} + \item[\textbf{5}] \textbf{C++} + \item[\textbf{6}] \textbf{Datenorganisation} + \vspace{-\smallskipamount} + \item[\textbf{\dots}] + \end{itemize} + +\end{frame} + +\setcounter{section}{2} +\section{Langzahl-Arithmetik} + +\begin{frame} + + \showsection + + Problem: Rechnen mit ganzen Zahlen, die größer sind als das,\\ + was der Rechner normalerweise verarbeiten kann + + \bigskip + + {\large\textbf{Aufgabe: Addition langer Zahlen}\par} + \smallskip + \begin{itemize} + \item[(a)] + Überlegen Sie sich eine Datenstruktur, um eine lange Zahl zu speichern. + \item[(b)] + Schreiben Sie eine Funktion, die zwei lange Zahlen addiert. + \end{itemize} + + \bigskip + + {\large\textbf{Lösungsansätze}\par} + \smallskip + \begin{itemize} + \item + ziffernweise (z.\,B.\ Zahlen als Strings abspeichern) + \item + zu einer Zehnerpotenz-Basis (z.\,B.\ 1\,000\,000\,000) + \item + zu einer Zweierpotenz-Basis (z.\,B.\ $2^{32}$)\\ + \item + speziell: Registerbreite \textarrow\ Hardware-Unterstützung (in Assembler) + \end{itemize} + +\end{frame} + +\begin{frame} + + \showsection + + Problem: Rechnen mit ganzen Zahlen, die größer sind als das,\\ + was der Rechner normalerweise verarbeiten kann + + \medskip + + \begin{itemize} + \item + Grundrechenarten (einschließlich "`modulo"'):\\ + "`schriftlich"' rechnen + \item + \href{https://de.wikipedia.org/wiki/Binäre_Exponentiation}% + {binäre Exponentiation}:\\ + Basis fortlaufend quadrieren, ggf.\ damit multiplizieren\\ + Beispiel: $x^9 = ((x^2)^2)^2 \cdot x$ + \item + Suche nach $d$ mit $d\cdot e~\text{mod}~N = 1$:\\ + \href{https://de.wikipedia.org/wiki/Erweiterter_euklidischer_Algorithmus}% + {erweiterter euklidischer Algorithmus} + \smallskip + \arrowitem + RSA + \end{itemize} + + \bigskip + + {\large\textbf{Aufgabe: RSA effizient implementieren}\par} + \smallskip + \begin{itemize} + \item + Verwenden Sie den Datentyp \lstinline{uint64_t} + (oder Langzahl-Arithmetik) + \item + Für Details siehe: \file{hp-20240411.txt} + \end{itemize} + +\end{frame} + +\section{Kryptographie} +\subsectionnonumber{\boldmath 4.$(x^2 - 1)$\quad Der Herr der Ringe: Manchmal ist $1 + 1 = 0$.} +\subsubsectionnonumber{\boldmath 4.$(x^2 - 1).x$\quad Motivation} + +\begin{frame} + + \showsection +% \pause + \showsubsectionnonumber +% \pause + \showsubsubsectionnonumber + + Man kann auch mit sehr merkwürdigen Objekten\\ + wie mit "`ganz normalen"' Zahlen rechnen. + +% \pause + \bigskip + + Anwendungen: + \begin{itemize} + \item Funktionsweise von Computern (\textarrow\ Rechnertechnik) + \item Fehlererkennung + \item Fehlerkorrektur + \item Verschlüsselung + \item Digitale Signaturen + \end{itemize} + +\end{frame} + +\subsubsectionnonumber{\boldmath 4.$(x^2 - 1).(x + 1)$\quad Gruppen} + +\begin{frame} + + \showsection + \showsubsectionnonumber + \showsubsubsectionnonumber + + \textbf{Definition:} + Sei $G$ eine Menge, $*$ eine Verknüpfung auf $G$. + Wenn + \begin{itemize} + \item + $\forall a, b, c \in G$: $(a * b) * c = a * (b * c)$ \quad (Assoziativgesetz), + \item + $\exists e \in G$: $\forall a \in G$: $a * e = e * a = a$ \quad (neutrales Element), + \item + $\forall a \in G$: $\exists a^{-1} \in G$: $a * a^{-1} = a^{-1} * a = e$ \quad (inverses Element), + \end{itemize} + dann heißt $(G,*)$ eine \newterm{Gruppe}. + +% \pause + \bigskip + + \textbf{Definition:} + Sei $(G,*)$ eine Gruppe. + Wenn zusätzlich + \begin{itemize} + \item + $\forall a, b \in G$: $a * b = b * a$ \quad (Kommutativgesetz), + \end{itemize} + dann heißt $(G,*)$ eine \newterm{kommutative Gruppe}. + +\end{frame} + +\subsubsectionnonumber{\boldmath 4.$(x^2 - 1).(x + 2)$\quad Ringe} + +\begin{frame} + +% \showsection + \showsubsectionnonumber + \showsubsubsectionnonumber + + \textbf{Definition:} + Sei $R$ eine Menge; seien $+$ und $\cdot$ Verknüpfungen auf $R$. + Wenn + \begin{itemize} + \item + $(R,+)$ eine kommutative Gruppe ist, + \item + $\forall a, b, c \in R$: $(a \cdot b) \cdot c = a \cdot (b \cdot c)$ \quad (Assoziativgesetz), + \item + $\forall a, b, c \in R$: $(a + b)\cdot c = a\cdot c + b\cdot c$ + und $a\cdot(b + c) = a\cdot b + a\cdot c$ \quad (Distributivgesetze), + \end{itemize} + dann heißt $(R,+,\cdot)$ ein \newterm{Ring}. + +% \pause + \bigskip + + \textbf{Definition:} + Sei $(R,+,\cdot)$ ein Ring. + Wenn zusätzlich + \begin{itemize} + \item + $\forall a, b \in R$: $a \cdot b = b \cdot a$ \quad (Kommutativgesetz), + \end{itemize} + dann heißt $(R,+,\cdot)$ ein \newterm{kommutativer Ring}. + +% \pause + \bigskip + + \textbf{Definition:} + Sei $(R,+,\cdot)$ ein (kommutativer) Ring. + Wenn zusätzlich + \begin{itemize} + \item + ein $e \in R$ existiert, so daß für alle $a \in R$ gilt: $a \cdot e = e \cdot a = a$\\ + (neutrales Element), + \end{itemize} + dann heißt $(R,+,\cdot)$ ein \newterm{(kommutativer) Ring mit 1}. + + \vspace*{-1cm} + +\end{frame} + +\subsubsectionnonumber{\boldmath 4.$(x^2 - 1).(x + 3)$\quad Körper} + +\begin{frame} + +% \showsection + \showsubsectionnonumber + \showsubsubsectionnonumber + + \textbf{Definition:} + Sei $K$ eine Menge; seien $+$ und $\cdot$ Verknüpfungen auf $K$. + Wenn + \begin{itemize} + \item + $(K,+,\cdot)$ ein Ring mit 1 ist und + \item + $(K \backslash \{0\},\cdot)$ eine kommutative Gruppe ist, + \end{itemize} + dann heißt $(K,+,\cdot)$ ein \newterm{Körper}. + +\end{frame} + +\subsubsectionnonumber{\boldmath 4.$(x^2 - 1).(x + 4)$\quad Anwendungen} + +\begin{frame} + +% \showsection + \showsubsectionnonumber + \showsubsubsectionnonumber + + Man kann auch mit sehr merkwürdigen Objekten\\ + wie mit "`ganz normalen"' Zahlen rechnen. + + \bigskip + + \begin{itemize} + \item + innermathematisch: Man kann beweisen,\\ + daß es ab $x^5$ keine "`$p$-$q$-Formel"' mehr gibt\\ + und daß bestimmte Operationen mit Zirkel und Lineal unmöglich sind. + \item + asymmetrische Verschlüsselung, Signaturen:\\ + RSA, ElGamal, elliptische Kurven + \item + symmetrische Verschlüsselung: AES + \item + Fehlererkennung: Parität, CRC\\ + Anwendungen: Datenübertragung, RAID + \item + Fehlerkorrektur: Reed-Solomon\\ + Anwendungen: Raumsonden, optische Datenträger, ECC-RAM + \end{itemize} + +\end{frame} + +\end{document} diff --git a/20240418/landau-symbols-2.pdf b/20240418/landau-symbols-2.pdf new file mode 120000 index 0000000000000000000000000000000000000000..6b458b6efd8e274824a6dfcaabc4b9c27d196dc4 --- /dev/null +++ b/20240418/landau-symbols-2.pdf @@ -0,0 +1 @@ +../common/landau-symbols-2.pdf \ No newline at end of file diff --git a/20240418/landau-symbols-3.pdf b/20240418/landau-symbols-3.pdf new file mode 120000 index 0000000000000000000000000000000000000000..46efa409b35ff5df763c744a423599cba515d886 --- /dev/null +++ b/20240418/landau-symbols-3.pdf @@ -0,0 +1 @@ +../common/landau-symbols-3.pdf \ No newline at end of file diff --git a/20240418/landau-symbols.pdf b/20240418/landau-symbols.pdf new file mode 120000 index 0000000000000000000000000000000000000000..ca145425bf07439c680632aa0663f84be601a565 --- /dev/null +++ b/20240418/landau-symbols.pdf @@ -0,0 +1 @@ +../common/landau-symbols.pdf \ No newline at end of file diff --git a/20240418/logo-hochschule-bochum-cvh-text.pdf b/20240418/logo-hochschule-bochum-cvh-text.pdf new file mode 120000 index 0000000000000000000000000000000000000000..a05946126bc0ce6a2818740da2893f59eb0c659c --- /dev/null +++ b/20240418/logo-hochschule-bochum-cvh-text.pdf @@ -0,0 +1 @@ +../common/logo-hochschule-bochum-cvh-text.pdf \ No newline at end of file diff --git a/20240418/logo-hochschule-bochum.pdf b/20240418/logo-hochschule-bochum.pdf new file mode 120000 index 0000000000000000000000000000000000000000..b6b9491e370e499c9276918182cdb82cb311bcd1 --- /dev/null +++ b/20240418/logo-hochschule-bochum.pdf @@ -0,0 +1 @@ +../common/logo-hochschule-bochum.pdf \ No newline at end of file diff --git a/20240418/pgslides.sty b/20240418/pgslides.sty new file mode 120000 index 0000000000000000000000000000000000000000..5be1416f4216f076aa268901f52a15d775e43f64 --- /dev/null +++ b/20240418/pgslides.sty @@ -0,0 +1 @@ +../common/pgslides.sty \ No newline at end of file