Initial commit
This commit is contained in:
commit
1ad2f0e3ab
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
build
|
32
Makefile
Normal file
32
Makefile
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
.PHONY: default clean
|
||||||
|
|
||||||
|
MD_SOURCES=$(shell find . -name '*.md' -not -path "./templates/*")
|
||||||
|
HTML_TARGETS=$(MD_SOURCES:%.md=build/%.html)
|
||||||
|
PDF_TARGETS=$(MD_SOURCES:%.md=build/%.pdf)
|
||||||
|
|
||||||
|
DOT_SOURCES=$(shell find . -name '*.dot' -not -path "./templates/*")
|
||||||
|
DOT_TARGETS=$(DOT_SOURCES:%.dot=build/%.png)
|
||||||
|
|
||||||
|
TEX_SOURCES=$(shell find . -not -path "./templates/*" -name '*.tex')
|
||||||
|
TEX_TARGETS=$(TEX_SOURCES:%.tex=build/%.pdf)
|
||||||
|
|
||||||
|
default: $(DOT_TARGETS) $(HTML_TARGETS) $(PDF_TARGETS) $(TEX_TARGETS)
|
||||||
|
|
||||||
|
build/%.html: %.md
|
||||||
|
@mkdir -p $$(dirname $@)
|
||||||
|
pandoc -s --mathjax --template ./templates/mindoc.html --toc --toc-depth=2 -o $@ $<
|
||||||
|
|
||||||
|
build/%.pdf: %.md
|
||||||
|
@mkdir -p $$(dirname $@)
|
||||||
|
pandoc --resource-path=$$(dirname $@) --template ./templates/eisvogel.tex --toc --toc-depth=2 -o $@ $<
|
||||||
|
|
||||||
|
build/%.png: %.dot
|
||||||
|
@mkdir -p $$(dirname $@)
|
||||||
|
dot -Tpng -o $@ $<
|
||||||
|
|
||||||
|
build/%.pdf: %.tex
|
||||||
|
@mkdir -p $$(dirname $@)
|
||||||
|
latexmk -pdf -outdir=$$(dirname $@) $<
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -r build
|
10
index.md
Normal file
10
index.md
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
title: My Knowledge Wiki
|
||||||
|
subtitle: >
|
||||||
|
Things to know, learn and remember
|
||||||
|
---
|
||||||
|
## University
|
||||||
|
|
||||||
|
- [Diskrete Mathematik](school/di-ma)
|
||||||
|
- [Einführung in die Kryptographie](school/intro-crypto)
|
||||||
|
- [Netzsicherheit 1](school/netsec1)
|
9
school/di-ma.md
Normal file
9
school/di-ma.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
title: Diskrete Mathematik
|
||||||
|
subtitle: >
|
||||||
|
Notizen und Mitschrift zur Vorlesung Diskrete Mathematik
|
||||||
|
---
|
||||||
|
|
||||||
|
- [2018-10-09 Intro](di-ma/20181009_1-intro)
|
||||||
|
- [2018-10-09 Kombinatorik](di-ma/20181009_2-kombinatorik)
|
||||||
|
- [2018-10-10 Binomialkoeffizient](di-ma/20181010_1-binomialkoeffizient)
|
24
school/di-ma/20181009-graph1.dot
Normal file
24
school/di-ma/20181009-graph1.dot
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
digraph undirected {
|
||||||
|
edge [ arrowhead="none" ];
|
||||||
|
node [ shape="circle" ];
|
||||||
|
{
|
||||||
|
rank=same;
|
||||||
|
2;
|
||||||
|
4;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
rank=same;
|
||||||
|
3;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
rank=same;
|
||||||
|
1;
|
||||||
|
5;
|
||||||
|
}
|
||||||
|
1 -> 2;
|
||||||
|
3 -> 2;
|
||||||
|
3 -> 4;
|
||||||
|
2 -> 4;
|
||||||
|
4 -> 5;
|
||||||
|
5 -> 6;
|
||||||
|
}
|
56
school/di-ma/20181009_1-intro.md
Normal file
56
school/di-ma/20181009_1-intro.md
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
---
|
||||||
|
title: Intro Veranstalting
|
||||||
|
date: 2018-10-09
|
||||||
|
---
|
||||||
|
|
||||||
|
# Organisatorisches
|
||||||
|
|
||||||
|
## Moodle
|
||||||
|
|
||||||
|
Passwort: `gauss`
|
||||||
|
|
||||||
|
## Übungen
|
||||||
|
|
||||||
|
- Bis zu 10% Bonus für Prüfung
|
||||||
|
- Bearbeitung von Dienstag bis Dienstag
|
||||||
|
- Abgabe in Kästen in NA?
|
||||||
|
- 3er Gruppen erlaubt
|
||||||
|
- Anmeldung ab 11.10. 12:00 Uhr
|
||||||
|
|
||||||
|
# Themen
|
||||||
|
|
||||||
|
1. Kombinatorik
|
||||||
|
2. Graphentheorie
|
||||||
|
3. Zahlentheorie/Algebra
|
||||||
|
|
||||||
|
|
||||||
|
## Beispiel zu 1.
|
||||||
|
|
||||||
|
### Gegeben
|
||||||
|
|
||||||
|
$n$ Bälle
|
||||||
|
|
||||||
|
$m$ Urnen
|
||||||
|
|
||||||
|
### Frage
|
||||||
|
|
||||||
|
Wieviele Möglichkeiten gibt es, die Bälle auf die Urnen zu verteilen?
|
||||||
|
|
||||||
|
#### Nebenbedingungen
|
||||||
|
|
||||||
|
1. Bälle/Urnen sind (nicht) Unterscheidbar
|
||||||
|
2. Mindestens in jeder Urne 1 Ball (surjektiv)
|
||||||
|
3. Höchstens 1 Ball pro Urne (injektiv)
|
||||||
|
4. Genau 1 Ball je Urne
|
||||||
|
|
||||||
|
## Beispiel zu 2.
|
||||||
|
|
||||||
|
![Ungerichteter Graph](./20181009-graph1.png)
|
||||||
|
|
||||||
|
### Gegeben
|
||||||
|
|
||||||
|
Ungerichteter Graph G
|
||||||
|
|
||||||
|
### Frage
|
||||||
|
|
||||||
|
Für 2 Knoten aus G. Was ist der kürzeste Weg zwischen den Knoten?
|
238
school/di-ma/20181009_2-kombinatorik.md
Normal file
238
school/di-ma/20181009_2-kombinatorik.md
Normal file
@ -0,0 +1,238 @@
|
|||||||
|
---
|
||||||
|
title: Kombinatorik
|
||||||
|
date: 2018-10-09
|
||||||
|
---
|
||||||
|
|
||||||
|
# Kombinatorik
|
||||||
|
|
||||||
|
## Elementare Zählprobleme und Grundlegende Regeln
|
||||||
|
|
||||||
|
### Beispiel
|
||||||
|
|
||||||
|
#### Gegeben
|
||||||
|
|
||||||
|
- 3 elementige Menge $M = \{1, 2, 3\}$
|
||||||
|
|
||||||
|
#### Frage
|
||||||
|
|
||||||
|
Wie viele Möglichkeiten gibt es, 2 Elemente azs M zu ziehen?
|
||||||
|
|
||||||
|
#### Antwort
|
||||||
|
|
||||||
|
It depends
|
||||||
|
|
||||||
|
--- | geordnet | ungeordnet
|
||||||
|
--- | --- | ---
|
||||||
|
mit zurücklegen | A:<br>$(1,1),(1,2),(1,3)$<br>$(2,1),(2,2),(2,3)$<br>$(3,1),(3,2),(3,3)$ | D:<br>$\{1,1\},\{1,2\}\{1,2\}$<br>$\{2,2\},\{3,2\}$<br>$\{3,3\}$
|
||||||
|
ohne zurücklegen | B:<br>$(1,2),(1,3)$<br>$(2,1),(2,3)$<br>$(3,1),(3,2)$ | C:<br>$\{1,2\},\{1,3\}$<br>$\{2,3\}$<br>
|
||||||
|
|
||||||
|
|
||||||
|
Wie viele Möglichkeiten gibt es allgemein, aus einer $n$-elementingen Menge $k$ elemente zu ziehen?
|
||||||
|
|
||||||
|
## *Zuerst:* Einfache Grundregeln
|
||||||
|
|
||||||
|
### Summenregel
|
||||||
|
|
||||||
|
Seien $S$, $T$ endliche Mengen, disjunkt, d.h. $S \cap T = \emptyset$ (Notation $S \dot\cup T$, disjunkte Vereinigung),
|
||||||
|
dann gilt
|
||||||
|
|
||||||
|
$$
|
||||||
|
| S \dot\cup T | = | S | + | T |
|
||||||
|
$$
|
||||||
|
|
||||||
|
Allgemeiner: Gegeben $S_1, S_2, ... S_n$, endliche, disjunkte Mengen, dann gilt
|
||||||
|
|
||||||
|
$$
|
||||||
|
| \dot\cup^n_{i=1} S_i | = | S_1 | + | S_2 | + ... + | S_n | = \sum\limits^n_{i=1} | S_i |
|
||||||
|
$$
|
||||||
|
|
||||||
|
|
||||||
|
### Produktregel
|
||||||
|
|
||||||
|
Seien $S$, $T$ endliche Mengen, dann gilt
|
||||||
|
$$
|
||||||
|
| S \times T | = | S | \cdot | T |
|
||||||
|
$$
|
||||||
|
wobei
|
||||||
|
$$
|
||||||
|
S \times T = \{(s,t) \mid s \in S, t \in T \}
|
||||||
|
$$
|
||||||
|
|
||||||
|
Allgemeiner: Gegeben $S_1, S_2, ... S_n$ endliche Mengen, dann gilt
|
||||||
|
|
||||||
|
$$
|
||||||
|
\vert S_1 \times S_2 \times ... S_n \vert = \vert S_1 \vert \cdot \vert S_2 \vert \cdot ... \vert S_n \vert
|
||||||
|
$$
|
||||||
|
|
||||||
|
#### Beispiel
|
||||||
|
|
||||||
|
$$
|
||||||
|
S_1, ..., S_n = \{0, 1\}, n = 64 \\
|
||||||
|
\vert S^n \vert = \vert \{0,1\}^{64} \vert = 2^{64}
|
||||||
|
$$
|
||||||
|
|
||||||
|
Anzahl der Zustände eines 64-bit Registers.
|
||||||
|
|
||||||
|
|
||||||
|
### Gleichheitsregel
|
||||||
|
|
||||||
|
Seien $S$, $T$ endliche Mengen und $f: S \to T$ eine bijektive Abbildung, dann gilt
|
||||||
|
$$
|
||||||
|
\vert S \vert = \vert T \vert
|
||||||
|
$$
|
||||||
|
|
||||||
|
(eigentlich: Definition von "gleich groß")
|
||||||
|
|
||||||
|
Allgemeiner: Seien $S$, $T$ endliche Mengen und $f: S \to T$ eine $k$ auf $1$ Abbildung, d.h. $\forall t \in T$ gilt
|
||||||
|
$\vert\{s \in S \mid f(s) = t \}\vert = \vert f^{-1}(t) \vert = k$ dann gilt
|
||||||
|
$$
|
||||||
|
\vert S \vert = k \cdot \vert T \vert
|
||||||
|
$$
|
||||||
|
|
||||||
|
Damit können wir nun die Fälle A - D untersuchen.
|
||||||
|
|
||||||
|
### Fall A
|
||||||
|
|
||||||
|
In Fall A zählen wir $k$-Tupel mit Komponenten aus der $n$-elementigen Menge $M$, d.h. Elemente aus
|
||||||
|
$M \times M \times ... M = M^k$
|
||||||
|
|
||||||
|
Aus der Produktregel folgt: Es gibt $\vert M \vert^k = n^k$ Möglichkeiten
|
||||||
|
|
||||||
|
|
||||||
|
#### Satz
|
||||||
|
|
||||||
|
Die Anzahl der $k$-Tupel mit Komponenten aus einer $n$-elementigen Menge ist
|
||||||
|
$$
|
||||||
|
n^k\\
|
||||||
|
\Box
|
||||||
|
$$
|
||||||
|
|
||||||
|
|
||||||
|
### Fall B
|
||||||
|
|
||||||
|
Wir ziehen aus einer $n$-elementigen Menge ohne zurücklegen
|
||||||
|
- Für die erste Komponente haben wir $n$ Möglichkeiten
|
||||||
|
- Für die zweite Komponente haben wir $n - 1$ Möglichkeiten
|
||||||
|
- usw.
|
||||||
|
|
||||||
|
D.h. insgesamt haben wir $n(n-1)(n-2)...(n-k+1) = n^{\underline{k}}$ Möglichkeiten ($k$-te absteigende Faktorielle).
|
||||||
|
|
||||||
|
#### Satz
|
||||||
|
|
||||||
|
Die Anzahl der $k$-Tupel mit paarweise verschiedenen Komponenten aus einer $n$-elementigen Menge ist
|
||||||
|
$$
|
||||||
|
n^{\underline{k}} = n\cdot(n-1)\cdot...\cdot(n-k+1)
|
||||||
|
$$
|
||||||
|
|
||||||
|
**Wichtiger Spezialfall**:
|
||||||
|
$$
|
||||||
|
n = k
|
||||||
|
$$
|
||||||
|
Dann ist das nichts anderes als die Anzahl der Permutationen von $n$ Elementen
|
||||||
|
|
||||||
|
##### Beispiel
|
||||||
|
|
||||||
|
$$
|
||||||
|
n = 3 \\
|
||||||
|
M = \{1,2,3\}
|
||||||
|
$$
|
||||||
|
|
||||||
|
Mögliche Permutationen: $(123), (132), (213), (231), (312), (321)$
|
||||||
|
|
||||||
|
$3! = 3\cdot2\cdot1$ Möglichkeiten
|
||||||
|
|
||||||
|
$n! = n\cdot(n-1)\cdot...\cdot2\cdot1$ Möglichkeiten
|
||||||
|
|
||||||
|
**Bemerkung:** Es gilt
|
||||||
|
$$
|
||||||
|
n^{\underline{k}} = \frac{n!}{(n-1)!}
|
||||||
|
$$
|
||||||
|
|
||||||
|
### Fall C
|
||||||
|
|
||||||
|
Wir zählen die Anzahl der $k$-elementigen Teilmengen einer $n$-elementigen Menge.
|
||||||
|
|
||||||
|
Von fall B zu Fall c durch ignorieren der Reihenfolge.
|
||||||
|
|
||||||
|
Beachte die Abbildung die einem $k$-Tupel mit paarweise verschiedenen Komponenten $(i_1, ..., i_k)$ die $k$-elementige
|
||||||
|
Teilmenge $\{i_1, ..., i_k\}$ zuordnet. Diese Abbildung ist $k!$ - auf $-1$ da jede $k$-elementige Teilmenge auf $k!$
|
||||||
|
Arten angeordnet werden kann.
|
||||||
|
|
||||||
|
Damit folgt (Gleichheitsregel)
|
||||||
|
|
||||||
|
#### Satz
|
||||||
|
|
||||||
|
Die Anzahl der $k$-elementigen Teilmengen einer $n$-elementigen Menge ist
|
||||||
|
$$
|
||||||
|
\binom{n}{k} = \frac{n^{\underline{k}}}{k!} = \frac{n!}{k!(n-k)!}
|
||||||
|
$$
|
||||||
|
|
||||||
|
$\binom{n}{k}$ ist der Binomialkoeffizient.
|
||||||
|
|
||||||
|
|
||||||
|
##### Beispiel
|
||||||
|
|
||||||
|
$$
|
||||||
|
n = 3, k = 2 \\
|
||||||
|
\binom{3}{2} = \frac{3!}{2! \cdot 1!} = \frac{3\cdot2}{2} = 3
|
||||||
|
$$
|
||||||
|
|
||||||
|
### Fall D
|
||||||
|
|
||||||
|
Hier zählen wir Multimengen. In einer Multimenge können Elemente mehrfach vorkommen, mit Vielfachheit.
|
||||||
|
|
||||||
|
In $k$-elementigen Multimengen addieren sich die Vielfachkeiten zu $k$.
|
||||||
|
|
||||||
|
Wir wollen die Gleichheitsregel anwenden. Dazu folgende Kodierung einer Multimenge:
|
||||||
|
|
||||||
|
- Zwei Symbole `*` und `|`
|
||||||
|
- Wir schreiben $t$ Sterne `*` falls ein Element $i$ Vielfachkeit $t$ hat
|
||||||
|
- Übergang von $i$ zu $i-1$ wird gekennzeichnet durch `|`
|
||||||
|
|
||||||
|
#### Beispiel 1
|
||||||
|
|
||||||
|
$M = \{1,2,3,4,5\}$ und Multimenge $S = \{1,1,1,3,3,4,4,4\}$ wird kodiert als
|
||||||
|
|
||||||
|
```
|
||||||
|
*** | | ** | *** |
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Beispiel 2
|
||||||
|
|
||||||
|
$T = \{1,1,5,5\}$ wird kodiert als
|
||||||
|
|
||||||
|
```
|
||||||
|
** | | | | **
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Jede $k$-elementige Multimenge einer $n$-elementigen Menge entspricht eindeutig einer Sequenz aus $k$ `*` Symbolen und
|
||||||
|
$n-1$ `|` Symbolen.
|
||||||
|
|
||||||
|
Jede Sequenz von $k$ `*` Symbolen und $n-1$ `|` Symbolen entspricht genau einer $k$-elementigen Multimenge.
|
||||||
|
|
||||||
|
Abbildung Multimenge $\to$ Kodierungssequenz ist bijektiv.
|
||||||
|
|
||||||
|
Wegen der Gleichheitsregel können wir also genausogut die Anzahl der möglichen Kodierungssequenzen zählen.
|
||||||
|
|
||||||
|
Kodierungssequenz hat die Länge $(n-1)+k$ und an $k$ Stellen steht ein `*`. Dann gibt es genau $\binom{n-1+k}{k}$
|
||||||
|
solcher Sequenzen.
|
||||||
|
|
||||||
|
#### Satz
|
||||||
|
|
||||||
|
Die Anzahl der $k$-elementigen Multimengen einer $n$-elementigen Menge ist
|
||||||
|
|
||||||
|
$$
|
||||||
|
\binom{n-1+k}{k}
|
||||||
|
$$
|
||||||
|
|
||||||
|
##### Beispiel
|
||||||
|
|
||||||
|
25 Eissorten. Wie viele mögliche Eisbecher mit 5 Kugeln gibt es?
|
||||||
|
|
||||||
|
**Antwort**:
|
||||||
|
|
||||||
|
$$
|
||||||
|
n = 25, k = 5 \\
|
||||||
|
\binom{25-1+5}{5} = \binom{29}{5} = 118755
|
||||||
|
$$
|
22
school/di-ma/20181010-personen.dot
Normal file
22
school/di-ma/20181010-personen.dot
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
digraph personen {
|
||||||
|
edge [ arrowhead="none" ];
|
||||||
|
node [ shape="circle" ];
|
||||||
|
1;
|
||||||
|
{
|
||||||
|
rank=same;
|
||||||
|
2;
|
||||||
|
3;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
rank=same;
|
||||||
|
4;
|
||||||
|
5;
|
||||||
|
}
|
||||||
|
1 -> 2;
|
||||||
|
1 -> 3;
|
||||||
|
1 -> 4;
|
||||||
|
1 -> 5;
|
||||||
|
4 -> 5;
|
||||||
|
5 -> 3;
|
||||||
|
2 -> 3;
|
||||||
|
}
|
223
school/di-ma/20181010_1-binomialkoeffizient.md
Normal file
223
school/di-ma/20181010_1-binomialkoeffizient.md
Normal file
@ -0,0 +1,223 @@
|
|||||||
|
---
|
||||||
|
title: Binomialkoeffizient
|
||||||
|
date: 2018-10-10
|
||||||
|
---
|
||||||
|
|
||||||
|
# Wiederholung
|
||||||
|
|
||||||
|
$n$ Elemente, $k$ mal ziehen:
|
||||||
|
|
||||||
|
--- | geordnet | ungeordnet
|
||||||
|
:---: | :---: | :---:
|
||||||
|
mit zurücklegen | $n^k$ | $\binom{n+k-1}{k}$
|
||||||
|
ohne zurücklegen | $n^{\underline{k}}$ | $\binom{n}{k} = \frac{n!}{k!\cdot(n-k)!}$
|
||||||
|
|
||||||
|
## Beispiel a
|
||||||
|
|
||||||
|
**Frage**: Wie viele 10-elementige Teilmengen von der 100-elementigen Menge $M = \{1,2,...100\}$
|
||||||
|
|
||||||
|
1. gibt es?
|
||||||
|
2. die entweder die 1 oder die 2 enthalten gibt es?
|
||||||
|
|
||||||
|
### Zu 1)
|
||||||
|
|
||||||
|
$$
|
||||||
|
\binom{100}{10}
|
||||||
|
$$
|
||||||
|
|
||||||
|
### Zu 2)
|
||||||
|
|
||||||
|
Zwei Teile:
|
||||||
|
|
||||||
|
* Die Anzahl der 10 elementingen Teilmengen, die 1 aber nicht 2 enthalten
|
||||||
|
* Die Anzahl der 10 elementingen Teilmengen, die 2 aber nicht 1 enthalten
|
||||||
|
|
||||||
|
In beiden Fällen gibt es $\binom{98}{9}$ Möglichkeiten.
|
||||||
|
|
||||||
|
Die Fälle sind disjunkt $\Rightarrow$ es gibt $2 \cdot \binom{98}{9}$ Möglichkeiten
|
||||||
|
|
||||||
|
|
||||||
|
## Beispiel b
|
||||||
|
|
||||||
|
Wahl mit 100 Wahlberechtigten und 2 Kandidaten. Jede Stimme hat 4 Möglichkeiten (Kandidat 1, Kandidat 2, enthalten oder
|
||||||
|
ungültig).
|
||||||
|
|
||||||
|
**Frage**: Wie viele Ergebnisse kann es geben?
|
||||||
|
|
||||||
|
Dies entspricht der Anzahl der 100 elementigen Multimengen einer 4-elementigen Menge
|
||||||
|
|
||||||
|
$$
|
||||||
|
\binom{100+4-1}{100} = \binom{103}{100} = 353702
|
||||||
|
$$
|
||||||
|
|
||||||
|
|
||||||
|
# Eigenschaften von Binomialkoeffizienten
|
||||||
|
|
||||||
|
**Satz**: Seien $n, k \in \mathbb{N}$ $k \leq n$ dann gilt
|
||||||
|
|
||||||
|
1. $\binom{n}{k} = \binom{n}{n-k}$
|
||||||
|
2. $\binom{n}{k} = \binom{n-1}{k} + \binom{n-1}{k-1}$
|
||||||
|
3. $\binom{n}{k} = \sum\limits^k_{l=0} \binom{n}{l} \cdot \binom{n}{k-l}$
|
||||||
|
4. $(a+b)^n = \sum\limits^n_{k=0} \binom{n}{k} \cdot a^k \cdot b^{n-k}$
|
||||||
|
|
||||||
|
## Beweis
|
||||||
|
|
||||||
|
Wir wollen kombinatorische Beweise geben. Wir zählen auf beiden Seiten der Gleichung die gleichen Objekte aber auf
|
||||||
|
verschiedene Weise.
|
||||||
|
|
||||||
|
**zu 1)** Sei $M$ eine $n$-elementige Menge
|
||||||
|
|
||||||
|
* $\binom{n}{k}$ zählt die $k$-elementigen Teilmengen von $M$
|
||||||
|
* $\binom{n}{n-k}$ zählt die $(n-k)$-elementigen Teilmengen von $M$
|
||||||
|
|
||||||
|
Wir betrachten die Abbildung
|
||||||
|
|
||||||
|
$$
|
||||||
|
f: \text{Teilmenge von M} \to \text{Teilmenge von M} \\
|
||||||
|
f(A) = M \setminus A = \{x \in M \mid x \notin A\} = A^{\mathrm{C}}
|
||||||
|
$$
|
||||||
|
|
||||||
|
Es gilt:
|
||||||
|
|
||||||
|
1. $\vert A \vert = k \Rightarrow \vert f(A) \vert = n-k$
|
||||||
|
2. $f$ ist bijektiv (die Umkehrabbildung ist $f$ selbst)
|
||||||
|
|
||||||
|
Damit folgt aus dem Gleichheitsprinzip
|
||||||
|
|
||||||
|
$$
|
||||||
|
\binom{n}{k} = \binom{n}{n-k}
|
||||||
|
$$
|
||||||
|
|
||||||
|
**zu 2)** Sei $M = \{1, ... n\}$ und $\mathbb{T} = \{A \subseteq M \mid \vert A \vert = k\}$
|
||||||
|
|
||||||
|
Es gilt $\vert\mathbb{T}\vert = \binom{n}{k}$
|
||||||
|
|
||||||
|
Wir teilen die Menge $\mathbb{T}$ auf in zwei disjunkte Teile
|
||||||
|
|
||||||
|
$$
|
||||||
|
\mathbb{T}_1 = \{ A \subseteq M \mid \vert A \vert = k, n \notin A\} \\
|
||||||
|
\mathbb{T}_2 = \{ A \subseteq M \mid \vert A \vert = k, n \in A\}
|
||||||
|
$$
|
||||||
|
|
||||||
|
Dann gilt (Summenregel)
|
||||||
|
|
||||||
|
$$
|
||||||
|
\binom{n}{k} = \vert \mathbb{T} \vert = \vert \mathbb{T}_1 \vert + \vert \mathbb{T}_2 \vert
|
||||||
|
$$
|
||||||
|
|
||||||
|
* $\vert \mathbb{T}_1 \vert = \binom{n-1}{k}$, denn Elemente aus $\mathbb{T}_1$ entsprechen $k$-elementigen Teilmengen
|
||||||
|
aus $M^\prime = \{1,... n-1\}$
|
||||||
|
* $\vert \mathbb{T}_2 \vert = \binom{n-1}{k-1}$, denn für jedes $A \in \mathbb{T}_2$, d.h.
|
||||||
|
$A \subseteq M, \vert A \vert = k$ und $n \in A$ betrachte
|
||||||
|
|
||||||
|
$$
|
||||||
|
A^\prime = A \setminus \{n\}
|
||||||
|
$$
|
||||||
|
|
||||||
|
$A^\prime$ ist eine $(k-1)$-elementige Teilmenge von $M^\prime = \{1,... n-1\}$
|
||||||
|
|
||||||
|
**zu 3)** Seien $A$, $B$ Mengen mit $\vert A \vert = n$ und $\vert B \vert = m$ mit $A \cap B = \emptyset$ (disjunkt)
|
||||||
|
|
||||||
|
$\binom{n+m}{k}$ ist die Anzahl der $k$-elementigen Teilmengen von $A \dot\cup B$ ($\vert A \dot\cup B \vert = n + m$).
|
||||||
|
|
||||||
|
Wir teilen die $k$-elementigen Teilmengen von $A \dot\cup B$ in $k+1$ disjunkte Fälle auf
|
||||||
|
|
||||||
|
** hier wäre ein Venn Diagramm. Mach das mal
|
||||||
|
|
||||||
|
**Fall l** (für $l \in \{0,...k\}$)
|
||||||
|
|
||||||
|
|
||||||
|
Betrachte die $k$-elementigen Teilmengen $S$ von $A \cup B$, so dass $\vert A \cap S \vert = l$
|
||||||
|
($\Leftrightarrow \vert B \cap S \vert = k - l$), d.h. wir betrachten die Anzahl der $l$-elemeniigen Teilmengen von $A$
|
||||||
|
und der $(k-l)$-elementigen Teilmenge von $B$.
|
||||||
|
|
||||||
|
Mit der Produktregel ergeben sich $\binom{n}{l} \cdot \binom{m}{k-l}$.
|
||||||
|
|
||||||
|
Mit der Summenformel ergibt sich
|
||||||
|
|
||||||
|
$$
|
||||||
|
\binom{n+m}{k} = \sum\limits^k_{l=0} \binom{n}{l} \cdot \binom{m}{k-l}
|
||||||
|
$$
|
||||||
|
|
||||||
|
**zu 4)**
|
||||||
|
|
||||||
|
$$
|
||||||
|
(a+b)^n = (a+b) \cdot (a+b) \cdot ... (a+b)
|
||||||
|
$$
|
||||||
|
|
||||||
|
Beim Ausmultiplizieren "entscheiden" wir uns für jede der $n$ Klammern for $a$ oder $b$. Für einen Term
|
||||||
|
$a^k\cdot b^{n-k}$ wählen wir aus den $n$ Klammern genau $k$-mal das $a$. Damit haben wir genau $\binom{n}{k}$
|
||||||
|
Möglichkeiten den Term $a^k \cdot b^{n-k}$ zu erhalten.
|
||||||
|
|
||||||
|
# Kombinatorische Prinzipien
|
||||||
|
|
||||||
|
## Schubfachprinzip
|
||||||
|
|
||||||
|
**Beispiel**: Wir haben 9 Schubladen und 10 Objekte, die wir auf die Schubladen verteilen wollen. Dann gibt es eine
|
||||||
|
Schublade, in der mindestens 2 Objekte landen.
|
||||||
|
|
||||||
|
### Satz
|
||||||
|
|
||||||
|
Seien $X$, $Y$ endliche Mengen mit $\vert X \vert \geq \vert Y \vert + 1$ und $f: X \to Y$ eine Abbildung dann
|
||||||
|
|
||||||
|
$$
|
||||||
|
\exists y \in Y \text{ so dass } \vert f^{-1}(y) \vert = \vert \{x\in X \mid f(x) = y\} \vert \geq 2
|
||||||
|
$$
|
||||||
|
|
||||||
|
### Beweis
|
||||||
|
|
||||||
|
Statt $A \Rightarrow B$ zeigen wir $\lnot B \Rightarrow \lnot A$
|
||||||
|
|
||||||
|
Sei $f: X \to Y$ gegeben so dass $\forall y \in Y$ gilt $\vert f^{-1}(y) \vert \leq 1$, dann gilt
|
||||||
|
|
||||||
|
$$
|
||||||
|
\vert X \vert = \sum\limits_{y \in Y} \vert f^{-1}(y) \vert \leq \sum\limits_{y \in Y} 1 = \vert Y \vert
|
||||||
|
$$
|
||||||
|
|
||||||
|
Allgemeiner gilt: Seien $X$, $Y$ endliche Mengen und $f: X \to Y$ eine Abbildung, dann $\exists y \in Y$ so dass
|
||||||
|
|
||||||
|
$$
|
||||||
|
\vert f^{-1}(y) \vert \geq \left\lceil \frac{\vert X \vert}{\vert Y \vert} \right\rceil
|
||||||
|
$$
|
||||||
|
|
||||||
|
($\lceil \cdot \rceil$ ist die obere Gaussklammer, das heißt die kleinste natürliche Zahl größer als $x$).
|
||||||
|
|
||||||
|
**Beispiel 1**: *Gegeben*: $n$ Personen $1,...n$ mit Bekanntschaftsrelationen, darstellbar als Graph mit Personen als
|
||||||
|
Konten und Kanten zwischen Knoten, falls sich die Personen kennen.
|
||||||
|
|
||||||
|
![Personen Graph](./20181010-personen.png)
|
||||||
|
|
||||||
|
* 1 kennt 4 Personen
|
||||||
|
* 2 kennt 2 Personen
|
||||||
|
* 3 kennt 3 Personen
|
||||||
|
* 4 kennt 2 Personen
|
||||||
|
* 5 kennt 3 Personen
|
||||||
|
|
||||||
|
Es gibt (mindestens) 2 Personen, die die gleiche Anzahl von Personen kennen. Dies gilt **immer**.
|
||||||
|
|
||||||
|
### Satz
|
||||||
|
|
||||||
|
Unter $n$ Personen gibt es immer mindestens 2, die die selbe Anzahl von Personen kennen.
|
||||||
|
|
||||||
|
### Beweis
|
||||||
|
|
||||||
|
Wir wollen das Schubfachprinzip nutzen. Für die Personen $P = \{1, ... n\}$ betrachte die Abbildung
|
||||||
|
$f: P \to \{0, ... n-1\}$, die jeder dieser Personen die Anzahl der Personen, die sie kennt, zuweist.
|
||||||
|
|
||||||
|
Problem: $\vert P \vert = n = \vert \{1, ... n\} \vert$
|
||||||
|
|
||||||
|
Betrachte 2 Fälle:
|
||||||
|
|
||||||
|
1. Es gibt eine Person, die niemanden kennt, das heißt $\exists i \in P$ so dass $f(i) = 0$. Dann gilt
|
||||||
|
$\forall j \in P \neq n - 1$ da "kennen" symmetrisch ist. Damit ist $f(P) \subseteq \{0, ... n-2\}$ und das
|
||||||
|
Schubfachprinzip ist anwendbar.
|
||||||
|
2. Es gibt keine Person, die niemanden kennt, dann $f(P) \subseteq \{1, ... n-1\}$ und auch hier ist das
|
||||||
|
Schubfachprinzip anwendbar.
|
||||||
|
|
||||||
|
$$
|
||||||
|
\Box
|
||||||
|
$$
|
||||||
|
|
||||||
|
**Beispiel 2**: In Bochum wohnen ca $350000$ Menschen, jeder Mensch hat zwischen $0$ und $150000$ Kopfhaare.
|
||||||
|
|
||||||
|
$\Rightarrow$ es gibt mindestens 2 Menschen in Bochum mit der gleichen Anzahl Haare.
|
8
school/intro-crypto.md
Normal file
8
school/intro-crypto.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
title: Einführung in die Kryptographie
|
||||||
|
subtitle: >
|
||||||
|
Notizen und Mitschrift zur Vorlesung Einführung in die Kryptographie
|
||||||
|
---
|
||||||
|
|
||||||
|
- [2018-10-11 Intro](intro-crypto/20181011_1-intro)
|
||||||
|
- [2018-10-11 Klassifikation, Kerckhoffs' Prinzip, Substitutionschiffre](intro-crypto/20181011_2-klassifikation)
|
28
school/intro-crypto/20181011-classification.dot
Normal file
28
school/intro-crypto/20181011-classification.dot
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
digraph classification {
|
||||||
|
edge [ arrowhead="none" ];
|
||||||
|
1 [ label="Kryptologie" ];
|
||||||
|
2 [ label="Kryptographie" ];
|
||||||
|
3 [ label="Kryptoanalyse" ];
|
||||||
|
4 [ label="symmetrische\nChiffren" ];
|
||||||
|
5 [ label="asymmetrische\nChiffren" ];
|
||||||
|
6 [ label="Protokolle\n& Sonstiges" ];
|
||||||
|
|
||||||
|
{
|
||||||
|
rank=same;
|
||||||
|
2;
|
||||||
|
3;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
rank=same;
|
||||||
|
4;
|
||||||
|
5;
|
||||||
|
6;
|
||||||
|
}
|
||||||
|
|
||||||
|
1 -> 2;
|
||||||
|
1 -> 3;
|
||||||
|
|
||||||
|
2 -> 4;
|
||||||
|
2 -> 5;
|
||||||
|
2 -> 6;
|
||||||
|
}
|
26
school/intro-crypto/20181011_1-intro.md
Normal file
26
school/intro-crypto/20181011_1-intro.md
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
---
|
||||||
|
title: Intro
|
||||||
|
date: 2018-10-11
|
||||||
|
---
|
||||||
|
|
||||||
|
# Moodle
|
||||||
|
|
||||||
|
**Kursnummer**: 141022
|
||||||
|
|
||||||
|
**Passwort** : krypto1819
|
||||||
|
|
||||||
|
# Klausur
|
||||||
|
|
||||||
|
* 10% Bonus durch Übungen, nur wenn bestanden (>49%)
|
||||||
|
* Anmeldung im Prüfungsamt
|
||||||
|
|
||||||
|
## Hilfsmittel
|
||||||
|
|
||||||
|
* Taschenrechner
|
||||||
|
* 1 Seite handschriftlich
|
||||||
|
|
||||||
|
# Übungen
|
||||||
|
|
||||||
|
**Abgabe**: Donnerstag 12:14 Uhr
|
||||||
|
|
||||||
|
Handschriftlich oder LaTeX (Vorlage vorhanden)
|
59
school/intro-crypto/20181011_2-klassifikation.md
Normal file
59
school/intro-crypto/20181011_2-klassifikation.md
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
---
|
||||||
|
title: Klassifikation, Grundlagen, Substitutionschiffre
|
||||||
|
date: 2018-10-11
|
||||||
|
---
|
||||||
|
|
||||||
|
# Klassifikation der "Kryptographie"
|
||||||
|
|
||||||
|
![Klassifikation](./20181011-classification.png)
|
||||||
|
|
||||||
|
## Anwendungen
|
||||||
|
|
||||||
|
* WhatsApp
|
||||||
|
* Auto
|
||||||
|
* Mensa Karte
|
||||||
|
* Medizinische Geräte
|
||||||
|
* Kreditkarten
|
||||||
|
* mobile Kommunikation
|
||||||
|
* IoT
|
||||||
|
* BitCoin
|
||||||
|
* Flugzeuge
|
||||||
|
* E-Mail
|
||||||
|
* (Schadsoftware)
|
||||||
|
|
||||||
|
# Grundlagen symmetrischer Chiffren
|
||||||
|
|
||||||
|
Einfache Ausgangssituation:
|
||||||
|
|
||||||
|
![Ausgangssituation](./20181011_situation.png)
|
||||||
|
|
||||||
|
* $e \widehat{=}$ Verschlüsselung oder Chiffrierung
|
||||||
|
* $d \widehat{=}$ Entschlüsselung oder Dechiffrierung
|
||||||
|
* $x \widehat{=}$ Klartext
|
||||||
|
* $y \widehat{=}$ Chiffrat
|
||||||
|
* $k \widehat{=}$ Schlüssel
|
||||||
|
* $\vert k \vert \widehat{=}$ Schlüsselraum
|
||||||
|
|
||||||
|
## Kerckhoffs' Prinzip
|
||||||
|
|
||||||
|
> Ein Kryptosystem muss auch dann sicher sein, wenn der Angreifer alle Deteils kennt, bis auf den Schlüssel.
|
||||||
|
|
||||||
|
Bei Verletzung der Prinzips: `Security by Obscurity`.
|
||||||
|
|
||||||
|
# Substitutionschiffre
|
||||||
|
|
||||||
|
* operiert auf Buchstaben
|
||||||
|
* Prinzip:
|
||||||
|
$$
|
||||||
|
A \to l \\
|
||||||
|
B \to d \\
|
||||||
|
C \to w \\
|
||||||
|
...
|
||||||
|
$$
|
||||||
|
|
||||||
|
**Beispiel**: $ABBA \to^e lddl$
|
||||||
|
|
||||||
|
## Angriffe
|
||||||
|
|
||||||
|
1. Häufigkeitsanalyse (Übung)
|
||||||
|
2. Vollständige Schlüsselsuche (Bruteforce): $\vert k \vert = 26! \approx 2^{88}$ Möglichkeiten
|
51
school/intro-crypto/20181011_situation.dot
Normal file
51
school/intro-crypto/20181011_situation.dot
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
digraph situation {
|
||||||
|
rankdir=LR;
|
||||||
|
a [ label="Alice" shape="none" ];
|
||||||
|
b [ label="Bob" shape="none" ];
|
||||||
|
o [ label="Oscar" shape="none" ];
|
||||||
|
i [ label="unsicherer\nKanal" ];
|
||||||
|
e [ label="e" shape="box" ];
|
||||||
|
d [ label="d" shape="box" ];
|
||||||
|
g [ label="Gen" shape="box"];
|
||||||
|
1 [ style="invisible" shape="point" width=0 ];
|
||||||
|
2 [ style="invisible" shape="point" width=0 ];
|
||||||
|
3 [ style="invisible" shape="point" width=0 ];
|
||||||
|
4 [ style="invisible" shape="point" width=0 ];
|
||||||
|
|
||||||
|
{
|
||||||
|
rank=same;
|
||||||
|
a;
|
||||||
|
g;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
rank=same;
|
||||||
|
e;
|
||||||
|
1;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
rank=same;
|
||||||
|
d;
|
||||||
|
2;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
rank=same;
|
||||||
|
i; o;
|
||||||
|
}
|
||||||
|
|
||||||
|
a -> e [ label="x" ];
|
||||||
|
e -> i [ label="y" ];
|
||||||
|
i -> d [ label="y" ];
|
||||||
|
d -> b [ label="x" ];
|
||||||
|
|
||||||
|
g -> 1 [ arrowhead="none" ];
|
||||||
|
1 -> e [ label="k" ];
|
||||||
|
1 -> 3 [ arrowhead="none" ];
|
||||||
|
3 -> 4 [ arrowhead="none"; penwidth=10; label="sicherer Kanal\n " ];
|
||||||
|
4 -> 2 [ arrowhead="none" ];
|
||||||
|
2 -> d [ label="k" ];
|
||||||
|
|
||||||
|
i -> o [ label="y" ];
|
||||||
|
}
|
51
school/intro-crypto/aufgaben/1/20181011_situation.dot
Normal file
51
school/intro-crypto/aufgaben/1/20181011_situation.dot
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
digraph situation {
|
||||||
|
rankdir=LR;
|
||||||
|
a [ label="Alice" shape="none" ];
|
||||||
|
b [ label="Bob" shape="none" ];
|
||||||
|
o [ label="Oscar" shape="none" ];
|
||||||
|
i [ label="unsicherer\nKanal" ];
|
||||||
|
e [ label="e" shape="box" ];
|
||||||
|
d [ label="d" shape="box" ];
|
||||||
|
g [ label="Gen" shape="box"];
|
||||||
|
1 [ style="invisible" shape="point" width=0 ];
|
||||||
|
2 [ style="invisible" shape="point" width=0 ];
|
||||||
|
3 [ style="invisible" shape="point" width=0 ];
|
||||||
|
4 [ style="invisible" shape="point" width=0 ];
|
||||||
|
|
||||||
|
{
|
||||||
|
rank=same;
|
||||||
|
a;
|
||||||
|
g;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
rank=same;
|
||||||
|
e;
|
||||||
|
1;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
rank=same;
|
||||||
|
d;
|
||||||
|
2;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
rank=same;
|
||||||
|
i; o;
|
||||||
|
}
|
||||||
|
|
||||||
|
a -> e [ label="x" ];
|
||||||
|
e -> i [ label="y" ];
|
||||||
|
i -> d [ label="y" ];
|
||||||
|
d -> b [ label="x" ];
|
||||||
|
|
||||||
|
g -> 1 [ arrowhead="none" ];
|
||||||
|
1 -> e [ label="k" ];
|
||||||
|
1 -> 3 [ arrowhead="none" ];
|
||||||
|
3 -> 4 [ arrowhead="none"; penwidth=10; label="sicherer Kanal\n " ];
|
||||||
|
4 -> 2 [ arrowhead="none" ];
|
||||||
|
2 -> d [ label="k" ];
|
||||||
|
|
||||||
|
i -> o [ label="y" ];
|
||||||
|
}
|
BIN
school/intro-crypto/aufgaben/1/Präsenzübung_1_EK1_WS1819.pdf
Normal file
BIN
school/intro-crypto/aufgaben/1/Präsenzübung_1_EK1_WS1819.pdf
Normal file
Binary file not shown.
99
school/intro-crypto/aufgaben/1/a1.tex
Normal file
99
school/intro-crypto/aufgaben/1/a1.tex
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
\documentclass[12pt,a4paper,german]{article}
|
||||||
|
\usepackage{url}
|
||||||
|
%\usepackage{graphics}
|
||||||
|
\usepackage{times}
|
||||||
|
\usepackage[T1]{fontenc}
|
||||||
|
\usepackage{ngerman}
|
||||||
|
\usepackage[latin1]{inputenc}
|
||||||
|
\usepackage{geometry}
|
||||||
|
\usepackage{amsfonts}
|
||||||
|
\usepackage{amsmath}
|
||||||
|
\usepackage{graphicx}
|
||||||
|
\usepackage{epsfig}
|
||||||
|
\usepackage{paralist}
|
||||||
|
\geometry{left=2.0cm,textwidth=17cm,top=3.5cm,textheight=23cm}
|
||||||
|
|
||||||
|
%%%%%%%%%% Fill out the the definitions %%%%%%%%%
|
||||||
|
\def \name {Valentin Brandl} %
|
||||||
|
\def \matrikel {108018274494} %
|
||||||
|
\def \gruppe {VB} %
|
||||||
|
\def \uebung {1} %
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
% DO NOT MODIFY THIS HEADER
|
||||||
|
\newcommand{\hwsol}{
|
||||||
|
\vspace*{-2cm}
|
||||||
|
\noindent \matrikel \quad \name \hfill Gruppe:\gruppe \\
|
||||||
|
% \noindent \pmatrikel \quad \pname \\
|
||||||
|
\begin{center}{\Large \bf L\"osung f\"ur \"Ubung \# \uebung}\end{center}
|
||||||
|
}
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
%Import header
|
||||||
|
\hwsol
|
||||||
|
|
||||||
|
|
||||||
|
\section*{Aufgabe 1}
|
||||||
|
\begin{enumerate}[(a)]
|
||||||
|
\item
|
||||||
|
\begin{itemize}
|
||||||
|
\item Algorithmen sollen offengelegt werden, nur Schlüssel werden geheim gehalten
|
||||||
|
\item Es ist schwer, einen Algorithmus geheim zu halten
|
||||||
|
\item Prinzip def vielen Augen: ein öffentlicher Algorithmus wird ggf. analysiert und Schwachstellen gefunden
|
||||||
|
\end{itemize}
|
||||||
|
\item
|
||||||
|
\begin{itemize}
|
||||||
|
\item Kryptographie: Entwerfen von Algorithmen und Protokollen
|
||||||
|
\item Kryptoanalyse: Schwachstellen in existierenden Verfahren suchen
|
||||||
|
\end{itemize}
|
||||||
|
|
||||||
|
\item
|
||||||
|
\parbox{\linewidth}{\centering
|
||||||
|
\includegraphics[width=\textwidth]{20181011_situation.png}
|
||||||
|
}
|
||||||
|
Ein Angreifer (Eve) kann die ausgetauschten Nachrichten mitlesen und verändern
|
||||||
|
\item
|
||||||
|
\begin{itemize}
|
||||||
|
\item Schlüssel: $k$
|
||||||
|
\item Verschlüsselung $e(\cdot)$
|
||||||
|
\item Schlüsselraum $\#k = \vert k \vert$
|
||||||
|
\item Chiffrat $y$
|
||||||
|
\item Entschlüsselung $d(\cdot)$
|
||||||
|
\item Klartext $x$
|
||||||
|
\end{itemize}
|
||||||
|
\end{enumerate}
|
||||||
|
|
||||||
|
\section*{Aufgabe 2}
|
||||||
|
\begin{enumerate}[(a)]
|
||||||
|
\item $2^{128}$. Mit $2^{10} \approx 10^3 \to 2^{130} \approx 10^{39}$
|
||||||
|
|
||||||
|
\item
|
||||||
|
\begin{itemize}
|
||||||
|
\item 80 Eur pro ASIC
|
||||||
|
\item $10^6$ Eur Kapital
|
||||||
|
\item $7 \cdot 10^8 \frac{k}{s}$ Leistung
|
||||||
|
\end{itemize}
|
||||||
|
\begin{eqnarray*}
|
||||||
|
10^6 / 80 &=& 12500 \\
|
||||||
|
7 \cdot 10^8 \cdot 12500 &=& 8.75 \cdot 10^{12} \frac{k}{s} \\
|
||||||
|
\frac{2^{128}k}{8.75 \cdot 10^{12} \frac{k}{s}} &\approx{}& 3.89 \cdot 10^{25} s \\
|
||||||
|
&\approx{}& 1.23 \cdot 10^{18} y
|
||||||
|
\end{eqnarray*}
|
||||||
|
|
||||||
|
\item
|
||||||
|
\begin{eqnarray*}
|
||||||
|
24 h &=& 86400 s \\
|
||||||
|
\frac{2^{128}}{x} &=& 86400 \\
|
||||||
|
\frac{2^{128}}{86400} &=& x \\
|
||||||
|
x &\approx{}& 3.94 \cdot 10^{33} \text{ gesuchte $\frac{k}{s}$} \\
|
||||||
|
\frac{x}{12500} &\approx{}& 3.15 \cdot 10^{29} \text{ gesuchte $\frac{k}{s}$ pro ASIC} \\
|
||||||
|
\\
|
||||||
|
(7 \cdot 10^8) \cdot 2^n &\geq{}& 3.15 \cdot 10^{29} \\
|
||||||
|
n &\geq{}& 68.6 \approx 69 \text{ (Leistung muss sich 69 mal verdoppeln)} \\
|
||||||
|
69 * 18m &=& 1242m = 103.5 y
|
||||||
|
\end{eqnarray*}
|
||||||
|
In $103.5$ Jahren wäre man in der Lage alle $2^{128}$ Schlüssel innerhlab von 24h durch zu probieren.
|
||||||
|
\end{enumerate}
|
||||||
|
|
||||||
|
\end{document}
|
||||||
|
|
67
school/intro-crypto/aufgaben/template.tex
Normal file
67
school/intro-crypto/aufgaben/template.tex
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
\documentclass[12pt,a4paper,german]{article}
|
||||||
|
\usepackage{url}
|
||||||
|
%\usepackage{graphics}
|
||||||
|
\usepackage{times}
|
||||||
|
\usepackage[T1]{fontenc}
|
||||||
|
\usepackage{ngerman}
|
||||||
|
\usepackage[latin1]{inputenc}
|
||||||
|
\usepackage{geometry}
|
||||||
|
\usepackage{amsfonts}
|
||||||
|
\usepackage{graphicx}
|
||||||
|
\usepackage{epsfig}
|
||||||
|
\usepackage{paralist}
|
||||||
|
\geometry{left=2.0cm,textwidth=17cm,top=3.5cm,textheight=23cm}
|
||||||
|
|
||||||
|
%%%%%%%%%% Fill out the the definitions %%%%%%%%%
|
||||||
|
\def \name {Vorname1 Nachname1} %
|
||||||
|
\def \matrikel {Matrikelnummer1} %
|
||||||
|
\def \pname {Vorname2 Nachname2} %
|
||||||
|
\def \pmatrikel {Matrikelnummer2} %
|
||||||
|
\def \gruppe {Gruppenkuerzel} %
|
||||||
|
\def \uebung {1} %
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
% DO NOT MODIFY THIS HEADER
|
||||||
|
\newcommand{\hwsol}{
|
||||||
|
\vspace*{-2cm}
|
||||||
|
\noindent \matrikel \quad \name \hfill Gruppe:\gruppe \\
|
||||||
|
\noindent \pmatrikel \quad \pname \\
|
||||||
|
\begin{center}{\Large \bf L\"osung f\"ur \"Ubung \# \uebung}\end{center}
|
||||||
|
}
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
%Import header
|
||||||
|
\hwsol
|
||||||
|
|
||||||
|
|
||||||
|
\section*{Aufgabe 1}
|
||||||
|
\begin{enumerate}[(a)]
|
||||||
|
\item Beispielantwort
|
||||||
|
\item Hier k\"onnte deine Antwort auf diese Teilaufgabe stehen.
|
||||||
|
\item Für das Beispiel gilt $b_1=2^4+1=17=(10001)_2$ und $b_2=2^4-1=15=(1111)_2$.
|
||||||
|
\end{enumerate}
|
||||||
|
|
||||||
|
\section*{Aufgabe 2}
|
||||||
|
Notation von mathematischen L\"osungen:
|
||||||
|
\begin{eqnarray*}
|
||||||
|
r_{0} &=& \beta^{K_{X}} \bmod n\\
|
||||||
|
r_{1} &=& \alpha^{K_{X}+1} = \alpha \cdot \alpha^{K_{n}} = \alpha \cdot r_{1} \bmod p\\
|
||||||
|
r_{2} &=& (a_{1}-d \cdot q_{1}) \cdot z_{E}^{-1} \bmod p-1 \Leftrightarrow d = (x_{1}-s_{1} \cdot o_{E}) \cdot r_{1}^{-1} \bmod p-1\\
|
||||||
|
\end{eqnarray*}
|
||||||
|
|
||||||
|
\section*{Aufgabe 3}
|
||||||
|
\begin{center}
|
||||||
|
\begin{tabular}{|c|c|c|c|}
|
||||||
|
\hline
|
||||||
|
Tabellenzeile & Tabellenzeile & Tabellenzeile & Tabellenzeile \\
|
||||||
|
\hline
|
||||||
|
e & f & g & h \\
|
||||||
|
\hline
|
||||||
|
i & j & k & l \\
|
||||||
|
\hline
|
||||||
|
m & n & o & p \\
|
||||||
|
\hline
|
||||||
|
\end{tabular}
|
||||||
|
\end{center}
|
||||||
|
\end{document}
|
||||||
|
|
248
school/intro-crypto/uebung/01/01.tex
Normal file
248
school/intro-crypto/uebung/01/01.tex
Normal file
@ -0,0 +1,248 @@
|
|||||||
|
\documentclass[12pt,a4paper,german]{article}
|
||||||
|
\usepackage{url}
|
||||||
|
%\usepackage{graphics}
|
||||||
|
\usepackage{times}
|
||||||
|
\usepackage[T1]{fontenc}
|
||||||
|
\usepackage{ngerman}
|
||||||
|
\usepackage{float}
|
||||||
|
\usepackage{diagbox}
|
||||||
|
\usepackage[latin1]{inputenc}
|
||||||
|
\usepackage{geometry}
|
||||||
|
\usepackage{amsfonts}
|
||||||
|
\usepackage{amsmath}
|
||||||
|
\usepackage{csquotes}
|
||||||
|
\usepackage{graphicx}
|
||||||
|
\usepackage{epsfig}
|
||||||
|
\usepackage{paralist}
|
||||||
|
\geometry{left=2.0cm,textwidth=17cm,top=3.5cm,textheight=23cm}
|
||||||
|
|
||||||
|
%%%%%%%%%% Fill out the the definitions %%%%%%%%%
|
||||||
|
\def \name {Valentin Brandl} %
|
||||||
|
\def \matrikel {108018274494} %
|
||||||
|
% \def \pname {Vorname2 Nachname2} %
|
||||||
|
% \def \pmatrikel {Matrikelnummer2} %
|
||||||
|
\def \gruppe {Gruppenkuerzel} %
|
||||||
|
\def \uebung {1} %
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
% DO NOT MODIFY THIS HEADER
|
||||||
|
\newcommand{\hwsol}{
|
||||||
|
\vspace*{-2cm}
|
||||||
|
\noindent \matrikel \quad \name \hfill Gruppe:\gruppe \\
|
||||||
|
% \noindent \pmatrikel \quad \pname \\
|
||||||
|
\begin{center}{\Large \bf L\"osung f\"ur \"Ubung \# \uebung}\end{center}
|
||||||
|
}
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
%Import header
|
||||||
|
\hwsol
|
||||||
|
|
||||||
|
|
||||||
|
\section*{Aufgabe 2}
|
||||||
|
\begin{enumerate}[(a)]
|
||||||
|
\item
|
||||||
|
\begin{eqnarray*}
|
||||||
|
A &\text{:}& 23 \to{} 0.02 \\
|
||||||
|
B &\text{:}& 5 \to{} 0.00 \\
|
||||||
|
C &\text{:}& 22 \to{} 0.02 \\
|
||||||
|
D &\text{:}& 8 \to{} 0.01 \\
|
||||||
|
E &\text{:}& 17 \to{} 0.02 \\
|
||||||
|
F &\text{:}& 2 \to{} 0.00 \\
|
||||||
|
G &\text{:}& 80 \to{} 0.07 \\
|
||||||
|
J &\text{:}& 66 \to{} 0.06 \\
|
||||||
|
K &\text{:}& 39 \to{} 0.04 \\
|
||||||
|
L &\text{:}& 47 \to{} 0.04 \\
|
||||||
|
M &\text{:}& 2 \to{} 0.00 \\
|
||||||
|
N &\text{:}& 17 \to{} 0.02 \\
|
||||||
|
O &\text{:}& 63 \to{} 0.06 \\
|
||||||
|
P &\text{:}& 80 \to{} 0.07 \\
|
||||||
|
Q &\text{:}& 62 \to{} 0.06 \\
|
||||||
|
R &\text{:}& 57 \to{} 0.05 \\
|
||||||
|
S &\text{:}& 136 \to{} 0.12 \\
|
||||||
|
T &\text{:}& 6 \to{} 0.01 \\
|
||||||
|
U &\text{:}& 57 \to{} 0.05 \\
|
||||||
|
V &\text{:}& 6 \to{} 0.01 \\
|
||||||
|
W &\text{:}& 76 \to{} 0.07 \\
|
||||||
|
X &\text{:}& 25 \to{} 0.02 \\
|
||||||
|
Y &\text{:}& 8 \to{} 0.01 \\
|
||||||
|
Z &\text{:}& 83 \to{} 0.08 \\
|
||||||
|
\text{\"A} &\text{:}& 43 \to{} 0.04 \\
|
||||||
|
\text{\"O} &\text{:}& 14 \to{} 0.01 \\
|
||||||
|
\text{\"U} &\text{:}& 28 \to{} 0.03 \\
|
||||||
|
\text{ß} &\text{:}& 18 \to{} 0.02 \\
|
||||||
|
sum &\text{:}& 1090
|
||||||
|
\end{eqnarray*}
|
||||||
|
|
||||||
|
\item
|
||||||
|
\begin{displayquote}
|
||||||
|
gründlich durchgecheckt steht sie da \\
|
||||||
|
und wartet auf den start - alles klar! \\
|
||||||
|
experten streiten sich um ein paar daten \\
|
||||||
|
die crew hat da noch ein paar fragen \\
|
||||||
|
doch der countdown läuft \\
|
||||||
|
\end{displayquote}
|
||||||
|
|
||||||
|
\item
|
||||||
|
\begin{tabular}{|c|c|}
|
||||||
|
\hline
|
||||||
|
von & zu \\\hline
|
||||||
|
A & f \\
|
||||||
|
B & ä \\
|
||||||
|
C & g \\
|
||||||
|
D & j \\
|
||||||
|
E & ö \\
|
||||||
|
F & x \\
|
||||||
|
G & n \\
|
||||||
|
J & i \\
|
||||||
|
K & m \\
|
||||||
|
L & c \\
|
||||||
|
M & ß \\
|
||||||
|
N & v \\
|
||||||
|
O & d \\
|
||||||
|
P & r \\
|
||||||
|
Q & a \\
|
||||||
|
R & l \\
|
||||||
|
S & e \\
|
||||||
|
T & ü \\
|
||||||
|
U & h \\
|
||||||
|
V & z \\
|
||||||
|
W & t \\
|
||||||
|
X & w \\
|
||||||
|
Y & p \\
|
||||||
|
Z & s \\
|
||||||
|
Ä & o \\
|
||||||
|
Ö & b \\
|
||||||
|
Ü & u \\
|
||||||
|
ß & k \\
|
||||||
|
H/I & q/y \\
|
||||||
|
\hline
|
||||||
|
\end{tabular}
|
||||||
|
|
||||||
|
Weder H noch I kommen im Ciphertext vor, daher ist es nicht möglich, die Substitution von H/I eindeutig zu
|
||||||
|
bestimmen. Da jedoch auch weder q noch y im Plaintext vorkommen, muss entweder $H \to q \text{ und } I \to y$
|
||||||
|
oder $H \to y \text{ und } I \to q$ gelten.
|
||||||
|
|
||||||
|
\item $30! = \vert \{A,B,...Z,\text{Ä},\text{Ö},\text{Ü},\text{ß}\} \vert!$
|
||||||
|
|
||||||
|
\item Name des Textes: Major Tom (völlig losgelöst) \\
|
||||||
|
Erscheinungsjahr: 1982
|
||||||
|
|
||||||
|
\end{enumerate}
|
||||||
|
|
||||||
|
\section*{Aufgabe 3}
|
||||||
|
\begin{enumerate}[(a)]
|
||||||
|
\item $2^{63} = 9,223,372,036,854,775,808$
|
||||||
|
\item $2^{63} * 0.03g = 276,701,161,105,643,260g \approx 276,701,161,106t$ \\
|
||||||
|
$277 \cdot 10^9 / 460 \cdot 10^6 \approx 602 \Rightarrow$ mehr als das 600-fache der jährlichen Reisernte
|
||||||
|
|
||||||
|
\item $2^{10} * 0.1mm = 102.4mm = 1.204m$
|
||||||
|
|
||||||
|
\item
|
||||||
|
\begin{eqnarray*}
|
||||||
|
2^n * 0.1mm &\geq{}& 1,000,000mm \\
|
||||||
|
2^n &\geq{}& 10000000 \\
|
||||||
|
n &\geq{}& 24
|
||||||
|
\end{eqnarray*}
|
||||||
|
Man muss das Blatt 24 mal falten.
|
||||||
|
|
||||||
|
\item
|
||||||
|
\begin{eqnarray*}
|
||||||
|
2^n * 0.1mm &\geq{}& 384,400,000,000mm \\
|
||||||
|
2^n &\geq{}& 3,844,000,000,000 \\
|
||||||
|
n &\geq{}& 42
|
||||||
|
\end{eqnarray*}
|
||||||
|
Man muss das Blatt 42 mal falten.
|
||||||
|
|
||||||
|
\item
|
||||||
|
\begin{eqnarray*}
|
||||||
|
2^n * 0.1mm &\geq{}& 9,460,730,472,580,800,000mm \\
|
||||||
|
2^n &\geq{}& 94,607,304,725,808,000,000mm \\
|
||||||
|
n &\geq{}& 67
|
||||||
|
\end{eqnarray*}
|
||||||
|
Man muss das Blatt 67 mal falten.
|
||||||
|
\end{enumerate}
|
||||||
|
|
||||||
|
\section*{Aufgabe 4}
|
||||||
|
\begin{enumerate}[(a)]
|
||||||
|
\item $2^n$
|
||||||
|
|
||||||
|
\item $\frac{2^n}{2}$
|
||||||
|
|
||||||
|
\item Gerechnet mit $1y = 365d$
|
||||||
|
\begin{figure}[h]
|
||||||
|
\begin{tabular}{|l|l|l|l|}
|
||||||
|
\hline
|
||||||
|
\diagbox{Case}{$n$} & 80 & 112 & 192 \\\hline
|
||||||
|
Worst Case & $2.50 * 10^8y$ & $1.08 * 10^{18}y$ & $1.30 * 10^{42}y$ \\\hline
|
||||||
|
Average Case & $1.25 * 10^8y$ & $5.38 * 10^{17}y$ & $6.50 * 10^{41}y$ \\\hline
|
||||||
|
\end{tabular}
|
||||||
|
\caption{GPU}
|
||||||
|
\end{figure}
|
||||||
|
|
||||||
|
\begin{figure}[h]
|
||||||
|
\begin{tabular}{|l|l|l|l|}
|
||||||
|
\hline
|
||||||
|
\diagbox{Case}{$n$} & 80 & 112 & 192 \\\hline
|
||||||
|
Worst Case & $5.81 * 10^7y$ & $2.49 * 10^{17}y$ & $3.02 * 10^{41}y$ \\\hline
|
||||||
|
Average Case & $2.90 * 10^7y$ & $1.25 * 10^{17}y$ & $1.51 * 10^{41}y$ \\\hline
|
||||||
|
\end{tabular}
|
||||||
|
\caption{Amazon Cloud}
|
||||||
|
\end{figure}
|
||||||
|
|
||||||
|
\begin{figure}[h]
|
||||||
|
\begin{tabular}{|l|l|l|l|}
|
||||||
|
\hline
|
||||||
|
\diagbox{Case}{$n$} & 80 & 112 & 192 \\\hline
|
||||||
|
Worst Case & $3.41 * 10^7y$ & $1.46 * 10^{17}y$ & $1.77 * 10^{41}y$ \\\hline
|
||||||
|
Average Case & $1.70 * 10^7y$ & $7.32 * 10^{16}y$ & $8.85 * 10^{40}y$ \\\hline
|
||||||
|
\end{tabular}
|
||||||
|
\caption{FPGA}
|
||||||
|
\end{figure}
|
||||||
|
|
||||||
|
\item Unter Anwendung der Erkenntnisse aus e):
|
||||||
|
\begin{eqnarray*}
|
||||||
|
n &=& 80 \\
|
||||||
|
n + w &=& 112 \\
|
||||||
|
w &=& 32 \\
|
||||||
|
x &=& \frac{2^{112} - 2^{80}}{r} \\
|
||||||
|
\end{eqnarray*}
|
||||||
|
|
||||||
|
\begin{itemize}
|
||||||
|
\item $r_{GPU} = 15.3 * 10^7 \frac{k}{s}$
|
||||||
|
\item $r_{Amazon} = 66 * 10^7 \frac{k}{s}$
|
||||||
|
\item $r_{FPGA} = 11.25 * 10^8 \frac{k}{s}$
|
||||||
|
\end{itemize}
|
||||||
|
|
||||||
|
\begin{eqnarray*}
|
||||||
|
x_{GPU} &=& 1.06 * 10^{18}y \\
|
||||||
|
x_{Amazon} &=& 2.49 * 10^{17}y \\
|
||||||
|
x_{FPGA} &=& 1.46 * 10^{17}y \\
|
||||||
|
\end{eqnarray*}
|
||||||
|
|
||||||
|
\item
|
||||||
|
\begin{itemize}
|
||||||
|
\item $r$: Anzahl der Versuche pro Sekunde
|
||||||
|
\item $n$: Aktuelle Bit Länge der Schlüssel
|
||||||
|
\item $w$: Verlängerung der Schlüssellänge um $w$ Bit
|
||||||
|
\item $x$: Gesucht: Wie viel langsamer der Angriff wird
|
||||||
|
\end{itemize}
|
||||||
|
\begin{eqnarray*}
|
||||||
|
\frac{2^n}{r} + x &=& \frac{2^{n+w}}{r} \\
|
||||||
|
x &=& \frac{2^{n+w} - 2^n}{r} \\
|
||||||
|
x &=& \frac{2^n(2^w-1)}{r}
|
||||||
|
\end{eqnarray*}
|
||||||
|
|
||||||
|
\item
|
||||||
|
\begin{eqnarray*}
|
||||||
|
183d &=& 4392h \\\\
|
||||||
|
\frac{4392}{2^n} &\leq{}& 1 \\
|
||||||
|
n &\geq{}& 13 \Rightarrow \text{ 13 Verdoppelungen der Rechenleistung} \\\\
|
||||||
|
13 * 18m &=& 234 m = 19.5y \approx 20y \\
|
||||||
|
1992 + 20 &=& 2012
|
||||||
|
\end{eqnarray*}
|
||||||
|
|
||||||
|
Seit dem Jahr 2012 sollte es möglich sein, 50-bit Keys in weniger als 1 Stunde zu Bruteforcen.
|
||||||
|
\end{enumerate}
|
||||||
|
|
||||||
|
\end{document}
|
||||||
|
|
60
school/intro-crypto/uebung/01/chiffrat.txt
Normal file
60
school/intro-crypto/uebung/01/chiffrat.txt
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
CPTGORJLU OÜPLUCSLUSLßW ZWSUW ZJS OQ
|
||||||
|
ÜGO XQPWSW QÜA OSG ZWQPW - QRRSZ ßRQP!
|
||||||
|
SFYSPWSG ZWPSJWSG ZJLU ÜK SJG YQQP OQWSG
|
||||||
|
OJS LPSX UQW OQ GÄLU SJG YQQP APQCSG
|
||||||
|
OÄLU OSP LÄÜGWOÄXG RBÜAW
|
||||||
|
|
||||||
|
SAASßWJNJWBW ÖSZWJKKW OQZ UQGOSRG
|
||||||
|
KQG NSPRBZZW ZJLU ÖRJGO QÜA OSG QGOSP'G
|
||||||
|
DSOSP XSJM CSGQÜ, XQZ NÄG JUK QÖUBGCW
|
||||||
|
DSOSP JZW JK ZWPSZZ, OÄLU KQDÄP WÄK
|
||||||
|
KQLUW SJGSG ZLUSPV
|
||||||
|
OQGG USÖW SP QÖ ÜGO
|
||||||
|
|
||||||
|
NERRJC RÄZCSREZW
|
||||||
|
NÄG OSP SPOS
|
||||||
|
ZLUXSÖW OQZ PQÜKZLUJAA
|
||||||
|
NERRJC ZLUXSPSRÄZ
|
||||||
|
|
||||||
|
|
||||||
|
OJS SPOQGVJSUÜGCZßPQAW JZW TÖSPXÜGOSG
|
||||||
|
QRRSZ RBÜAW YSPASßW, ZLUÄG ZSJW ZWÜGOSG
|
||||||
|
XJZZSGZLUQAWRJLUS SFYSPJKSGWS
|
||||||
|
OÄLU XQZ GTWVSG OJS QK SGOS, OSGßW
|
||||||
|
ZJLU KQDÄP WÄK
|
||||||
|
|
||||||
|
JK ßÄGWPÄRRVSGWPÜK, OQ XJPO KQG YQGJZLU
|
||||||
|
OSP ßÜPZ OSP ßQYZSR, OSP ZWJKKW DQ CQP GJLUW
|
||||||
|
"UQRRÄ KQDÄP WÄK, ßEGGSG ZJS UEPSG
|
||||||
|
XÄRR'G ZJS OQZ YPÄDSßW OSGG ZÄ VSPZWEPSG?"
|
||||||
|
OÄLU SP ßQGG GJLUWZ UEP'G
|
||||||
|
SP ZLUXSÖW XSJWSP
|
||||||
|
|
||||||
|
NERRJC RÄZCSREZW
|
||||||
|
NÄG OSP SPOS
|
||||||
|
ZLUXSÖW OQZ PQÜKZLUJAA
|
||||||
|
NERRJC ZLUXSPSRÄZ
|
||||||
|
|
||||||
|
OJS SPOS ZLUJKKSPW ÖRQÜ, ZSJG RSWVWSP AÜGß ßÄKKW
|
||||||
|
"CPTMW KJP KSJGS APQÜ", ÜGO SP NSPZWÜKKW
|
||||||
|
|
||||||
|
ÜGWSG WPQÜSPG GÄLU OJS SCÄJZWSG
|
||||||
|
KQDÄP WÄK OSGßW ZJLU, XSGG OJS XTZZWSG
|
||||||
|
KJLU ATUPW UJSP SJG RJLUW OÜPLU OQZ QRR
|
||||||
|
OQZ ßSGGW JUP GÄLU GJLUW, JLU ßÄKKS ÖQRO
|
||||||
|
KJP XJPO ßQRW
|
||||||
|
|
||||||
|
NERRJC RÄZCSREZW
|
||||||
|
NÄG OSP SPOS
|
||||||
|
ZLUXSÖW OQZ PQÜKZLUJAA
|
||||||
|
ZLUXSPSRÄZ
|
||||||
|
|
||||||
|
NERRJC RÄZCSREZW
|
||||||
|
NÄG OSP SPOS
|
||||||
|
ZLUXSÖW OQZ PQÜKZLUJAA
|
||||||
|
ZLUXSPSRÄZ
|
||||||
|
|
||||||
|
NERRJC RÄZCSREZW
|
||||||
|
NÄG OSP SPOS
|
||||||
|
ZLUXSÖW OQZ PQÜKZLUJAA
|
||||||
|
NERRJC ZLUXSPSRÄZ
|
30
school/intro-crypto/uebung/01/table.txt
Normal file
30
school/intro-crypto/uebung/01/table.txt
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
A & f \\
|
||||||
|
B & ä \\
|
||||||
|
C & g \\
|
||||||
|
D & j \\
|
||||||
|
E & ö \\
|
||||||
|
F & x \\
|
||||||
|
G & n \\
|
||||||
|
J & i \\
|
||||||
|
K & m \\
|
||||||
|
L & c \\
|
||||||
|
M & ß \\
|
||||||
|
N & v \\
|
||||||
|
O & d \\
|
||||||
|
P & r \\
|
||||||
|
Q & a \\
|
||||||
|
R & l \\
|
||||||
|
S & e \\
|
||||||
|
T & ü \\
|
||||||
|
U & h \\
|
||||||
|
V & z \\
|
||||||
|
W & t \\
|
||||||
|
X & w \\
|
||||||
|
Y & p \\
|
||||||
|
Z & s \\
|
||||||
|
Ä & o \\
|
||||||
|
Ö & b \\
|
||||||
|
Ü & u \\
|
||||||
|
ß & k \\
|
||||||
|
? & q \\
|
||||||
|
? & y \\
|
2
school/intro-crypto/uebung/01/u01/.gitignore
vendored
Normal file
2
school/intro-crypto/uebung/01/u01/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/target
|
||||||
|
**/*.rs.bk
|
32
school/intro-crypto/uebung/01/u01/Cargo.lock
generated
Normal file
32
school/intro-crypto/uebung/01/u01/Cargo.lock
generated
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
[[package]]
|
||||||
|
name = "countmap"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-traits"
|
||||||
|
version = "0.1.43"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-traits"
|
||||||
|
version = "0.2.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "u01"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"countmap 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[metadata]
|
||||||
|
"checksum countmap 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1ef2a403c4af585607826502480ab6e453f320c230ef67255eee21f0cc72c0a6"
|
||||||
|
"checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31"
|
||||||
|
"checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1"
|
7
school/intro-crypto/uebung/01/u01/Cargo.toml
Normal file
7
school/intro-crypto/uebung/01/u01/Cargo.toml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[package]
|
||||||
|
name = "u01"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Valentin Brandl <vbrandl@riseup.net>"]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
countmap = "0.2.0"
|
81
school/intro-crypto/uebung/01/u01/src/main.rs
Normal file
81
school/intro-crypto/uebung/01/u01/src/main.rs
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
extern crate countmap;
|
||||||
|
|
||||||
|
use countmap::CountMap;
|
||||||
|
use std::{
|
||||||
|
fs::File,
|
||||||
|
io::{BufRead, BufReader},
|
||||||
|
};
|
||||||
|
|
||||||
|
fn count() {
|
||||||
|
let args: Vec<_> = std::env::args().collect();
|
||||||
|
let file = args.get(1).unwrap();
|
||||||
|
let mut map: CountMap<char, u32> = CountMap::new();
|
||||||
|
let read = BufReader::new(File::open(file).unwrap());
|
||||||
|
for line in read.lines() {
|
||||||
|
if let Ok(line) = line {
|
||||||
|
line.chars().filter(|c| c.is_alphabetic()).for_each(|c| {
|
||||||
|
map.insert_or_increment(c);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let sum: u32 = map
|
||||||
|
.iter()
|
||||||
|
.filter(|(k, _)| k.is_alphabetic())
|
||||||
|
.map(|(_, v)| v)
|
||||||
|
.sum();
|
||||||
|
let mut vec: Vec<_> = map.into_iter().collect();
|
||||||
|
vec.sort_unstable();
|
||||||
|
vec.into_iter().for_each(|(k, v)| {
|
||||||
|
println!(
|
||||||
|
"{} &\\text{{:}}& {:3} \\to{{}} {:.2} \\\\",
|
||||||
|
k,
|
||||||
|
v,
|
||||||
|
v as f64 / sum as f64
|
||||||
|
)
|
||||||
|
});
|
||||||
|
println!("sum &\\text{{:}}& {}", sum);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let args: Vec<_> = std::env::args().collect();
|
||||||
|
let file = args.get(1).unwrap();
|
||||||
|
let read = BufReader::new(File::open(file).unwrap());
|
||||||
|
for line in read.lines() {
|
||||||
|
if let Ok(line) = line {
|
||||||
|
let s: String = line
|
||||||
|
.chars()
|
||||||
|
.map(|c| match c {
|
||||||
|
'A' => 'f',
|
||||||
|
'B' => 'ä',
|
||||||
|
'C' => 'g',
|
||||||
|
'D' => 'j',
|
||||||
|
'E' => 'ö',
|
||||||
|
'F' => 'x',
|
||||||
|
'G' => 'n',
|
||||||
|
'J' => 'i',
|
||||||
|
'K' => 'm',
|
||||||
|
'L' => 'c',
|
||||||
|
'M' => 'ß',
|
||||||
|
'N' => 'v',
|
||||||
|
'O' => 'd',
|
||||||
|
'P' => 'r',
|
||||||
|
'Q' => 'a',
|
||||||
|
'R' => 'l',
|
||||||
|
'S' => 'e',
|
||||||
|
'T' => 'ü',
|
||||||
|
'U' => 'h',
|
||||||
|
'V' => 'z',
|
||||||
|
'W' => 't',
|
||||||
|
'X' => 'w',
|
||||||
|
'Y' => 'p',
|
||||||
|
'Z' => 's',
|
||||||
|
'Ä' => 'o',
|
||||||
|
'Ö' => 'b',
|
||||||
|
'Ü' => 'u',
|
||||||
|
'ß' => 'k',
|
||||||
|
c => c,
|
||||||
|
}).collect();
|
||||||
|
println!("{}", s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
BIN
school/intro-crypto/uebung/01/Übung_1_EK1_WS1819.pdf
Normal file
BIN
school/intro-crypto/uebung/01/Übung_1_EK1_WS1819.pdf
Normal file
Binary file not shown.
67
school/intro-crypto/uebung/template.tex
Normal file
67
school/intro-crypto/uebung/template.tex
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
\documentclass[12pt,a4paper,german]{article}
|
||||||
|
\usepackage{url}
|
||||||
|
%\usepackage{graphics}
|
||||||
|
\usepackage{times}
|
||||||
|
\usepackage[T1]{fontenc}
|
||||||
|
\usepackage{ngerman}
|
||||||
|
\usepackage[latin1]{inputenc}
|
||||||
|
\usepackage{geometry}
|
||||||
|
\usepackage{amsfonts}
|
||||||
|
\usepackage{graphicx}
|
||||||
|
\usepackage{epsfig}
|
||||||
|
\usepackage{paralist}
|
||||||
|
\geometry{left=2.0cm,textwidth=17cm,top=3.5cm,textheight=23cm}
|
||||||
|
|
||||||
|
%%%%%%%%%% Fill out the the definitions %%%%%%%%%
|
||||||
|
\def \name {Vorname1 Nachname1} %
|
||||||
|
\def \matrikel {Matrikelnummer1} %
|
||||||
|
\def \pname {Vorname2 Nachname2} %
|
||||||
|
\def \pmatrikel {Matrikelnummer2} %
|
||||||
|
\def \gruppe {Gruppenkuerzel} %
|
||||||
|
\def \uebung {1} %
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
% DO NOT MODIFY THIS HEADER
|
||||||
|
\newcommand{\hwsol}{
|
||||||
|
\vspace*{-2cm}
|
||||||
|
\noindent \matrikel \quad \name \hfill Gruppe:\gruppe \\
|
||||||
|
\noindent \pmatrikel \quad \pname \\
|
||||||
|
\begin{center}{\Large \bf L\"osung f\"ur \"Ubung \# \uebung}\end{center}
|
||||||
|
}
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
%Import header
|
||||||
|
\hwsol
|
||||||
|
|
||||||
|
|
||||||
|
\section*{Aufgabe 1}
|
||||||
|
\begin{enumerate}[(a)]
|
||||||
|
\item Beispielantwort
|
||||||
|
\item Hier k\"onnte deine Antwort auf diese Teilaufgabe stehen.
|
||||||
|
\item Für das Beispiel gilt $b_1=2^4+1=17=(10001)_2$ und $b_2=2^4-1=15=(1111)_2$.
|
||||||
|
\end{enumerate}
|
||||||
|
|
||||||
|
\section*{Aufgabe 2}
|
||||||
|
Notation von mathematischen L\"osungen:
|
||||||
|
\begin{eqnarray*}
|
||||||
|
r_{0} &=& \beta^{K_{X}} \bmod n\\
|
||||||
|
r_{1} &=& \alpha^{K_{X}+1} = \alpha \cdot \alpha^{K_{n}} = \alpha \cdot r_{1} \bmod p\\
|
||||||
|
r_{2} &=& (a_{1}-d \cdot q_{1}) \cdot z_{E}^{-1} \bmod p-1 \Leftrightarrow d = (x_{1}-s_{1} \cdot o_{E}) \cdot r_{1}^{-1} \bmod p-1\\
|
||||||
|
\end{eqnarray*}
|
||||||
|
|
||||||
|
\section*{Aufgabe 3}
|
||||||
|
\begin{center}
|
||||||
|
\begin{tabular}{|c|c|c|c|}
|
||||||
|
\hline
|
||||||
|
Tabellenzeile & Tabellenzeile & Tabellenzeile & Tabellenzeile \\
|
||||||
|
\hline
|
||||||
|
e & f & g & h \\
|
||||||
|
\hline
|
||||||
|
i & j & k & l \\
|
||||||
|
\hline
|
||||||
|
m & n & o & p \\
|
||||||
|
\hline
|
||||||
|
\end{tabular}
|
||||||
|
\end{center}
|
||||||
|
\end{document}
|
||||||
|
|
65
school/netsec/20181012_0-intro.md
Normal file
65
school/netsec/20181012_0-intro.md
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
---
|
||||||
|
title: Intro
|
||||||
|
date: 2018-10-12
|
||||||
|
---
|
||||||
|
|
||||||
|
# Intro
|
||||||
|
|
||||||
|
**Prof**: Jörg Schwenk
|
||||||
|
|
||||||
|
Beteiligt an EFAIL?
|
||||||
|
|
||||||
|
## Moodle
|
||||||
|
|
||||||
|
Nächste Vorlesung
|
||||||
|
|
||||||
|
## Klausur
|
||||||
|
|
||||||
|
### Hilfsmittel
|
||||||
|
|
||||||
|
* Buch
|
||||||
|
|
||||||
|
## Übungen
|
||||||
|
|
||||||
|
Erst ab 2018-10-19.
|
||||||
|
|
||||||
|
## Links
|
||||||
|
|
||||||
|
* [Blog](https://web-in-security.blogspot.com)
|
||||||
|
|
||||||
|
## Buch
|
||||||
|
|
||||||
|
Wird überarbeitet.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
> Wir werden kein Blockchain machen, in dieser Vorlesung
|
||||||
|
|
||||||
|
|
||||||
|
**Schwerpunkt in Netsec 2**: TLS
|
||||||
|
|
||||||
|
|
||||||
|
## Notzizen
|
||||||
|
|
||||||
|
* **Starker Angriff**: Wenig Voraussetzungen
|
||||||
|
* **Schwacher Angriff**: Viele Voraussetzungen
|
||||||
|
|
||||||
|
**EC**:
|
||||||
|
|
||||||
|
$$
|
||||||
|
y^2 = x^3 + \underline{a}x + \underline{b}
|
||||||
|
$$
|
||||||
|
|
||||||
|
$b$ ggf nicht geprüft
|
||||||
|
|
||||||
|
## Nachschlagen
|
||||||
|
|
||||||
|
* DNSSEC schwache Schlüssel
|
||||||
|
* Bleichenbacher
|
||||||
|
* Chinesischer Restsatz
|
||||||
|
* Small Subgroup Attack (TLS)
|
||||||
|
* TLS Attacher
|
||||||
|
* DOMParator
|
||||||
|
* Professos
|
||||||
|
* WS-Attacker
|
10
school/netsec/20181012_1-kryptographie_und_das_internet.md
Normal file
10
school/netsec/20181012_1-kryptographie_und_das_internet.md
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
title: Kryptographie und das Internet
|
||||||
|
date: 2018-10-12
|
||||||
|
---
|
||||||
|
|
||||||
|
# Kryptographie und das Internet
|
||||||
|
|
||||||
|
**AE**: Authenticated Encryption
|
||||||
|
|
||||||
|
**AEAD**: AE with Additional Data
|
8
school/netsec1.md
Normal file
8
school/netsec1.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
title: Netzsicherheit 1
|
||||||
|
---
|
||||||
|
|
||||||
|
# Netzsicherheit 1
|
||||||
|
|
||||||
|
- [2018-10-12 Intro](netsec/20181012_0-intro)
|
||||||
|
- [2018-10-12 Kryptographie und das Internet](netsec/20181012_1-kryptographie_und_das_internet)
|
805
templates/eisvogel.tex
Normal file
805
templates/eisvogel.tex
Normal file
@ -0,0 +1,805 @@
|
|||||||
|
%%
|
||||||
|
% Copyright (c) 2018, Pascal Wagler;
|
||||||
|
% Copyright (c) 2014--2018, John MacFarlane
|
||||||
|
%
|
||||||
|
% All rights reserved.
|
||||||
|
%
|
||||||
|
% Redistribution and use in source and binary forms, with or without
|
||||||
|
% modification, are permitted provided that the following conditions
|
||||||
|
% are met:
|
||||||
|
%
|
||||||
|
% - Redistributions of source code must retain the above copyright
|
||||||
|
% notice, this list of conditions and the following disclaimer.
|
||||||
|
%
|
||||||
|
% - Redistributions in binary form must reproduce the above copyright
|
||||||
|
% notice, this list of conditions and the following disclaimer in the
|
||||||
|
% documentation and/or other materials provided with the distribution.
|
||||||
|
%
|
||||||
|
% - Neither the name of John MacFarlane nor the names of other
|
||||||
|
% contributors may be used to endorse or promote products derived
|
||||||
|
% from this software without specific prior written permission.
|
||||||
|
%
|
||||||
|
% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
% "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
% LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
% FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
% COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
% INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
% BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
% LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
% CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
% LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
% ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
% POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
%%
|
||||||
|
|
||||||
|
%%
|
||||||
|
% For usage information and examples visit the GitHub page of this template:
|
||||||
|
% https://github.com/Wandmalfarbe/pandoc-latex-template
|
||||||
|
%%
|
||||||
|
|
||||||
|
\PassOptionsToPackage{unicode=true}{hyperref} % options for packages loaded elsewhere
|
||||||
|
\PassOptionsToPackage{hyphens}{url}
|
||||||
|
\PassOptionsToPackage{dvipsnames,svgnames*,table}{xcolor}
|
||||||
|
$if(dir)$$if(latex-dir-rtl)$
|
||||||
|
\PassOptionsToPackage{RTLdocument}{bidi}
|
||||||
|
$endif$$endif$%
|
||||||
|
\documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$babel-lang$,$endif$$if(papersize)$$papersize$paper,$else$a4paper,$endif$$if(beamer)$ignorenonframetext,$if(handout)$handout,$endif$$if(aspectratio)$aspectratio=$aspectratio$,$endif$$endif$$for(classoption)$$classoption$$sep$,$endfor$,tablecaptionabove]{$if(book)$scrbook$else$scrartcl$endif$}
|
||||||
|
$if(beamer)$
|
||||||
|
$if(background-image)$
|
||||||
|
\usebackgroundtemplate{%
|
||||||
|
\includegraphics[width=\paperwidth]{$background-image$}%
|
||||||
|
}
|
||||||
|
$endif$
|
||||||
|
\usepackage{pgfpages}
|
||||||
|
\setbeamertemplate{caption}[numbered]
|
||||||
|
\setbeamertemplate{caption label separator}{: }
|
||||||
|
\setbeamercolor{caption name}{fg=normal text.fg}
|
||||||
|
\beamertemplatenavigationsymbols$if(navigation)$$navigation$$else$empty$endif$
|
||||||
|
$for(beameroption)$
|
||||||
|
\setbeameroption{$beameroption$}
|
||||||
|
$endfor$
|
||||||
|
% Prevent slide breaks in the middle of a paragraph:
|
||||||
|
\widowpenalties 1 10000
|
||||||
|
\raggedbottom
|
||||||
|
$if(section-titles)$
|
||||||
|
\setbeamertemplate{part page}{
|
||||||
|
\centering
|
||||||
|
\begin{beamercolorbox}[sep=16pt,center]{part title}
|
||||||
|
\usebeamerfont{part title}\insertpart\par
|
||||||
|
\end{beamercolorbox}
|
||||||
|
}
|
||||||
|
\setbeamertemplate{section page}{
|
||||||
|
\centering
|
||||||
|
\begin{beamercolorbox}[sep=12pt,center]{part title}
|
||||||
|
\usebeamerfont{section title}\insertsection\par
|
||||||
|
\end{beamercolorbox}
|
||||||
|
}
|
||||||
|
\setbeamertemplate{subsection page}{
|
||||||
|
\centering
|
||||||
|
\begin{beamercolorbox}[sep=8pt,center]{part title}
|
||||||
|
\usebeamerfont{subsection title}\insertsubsection\par
|
||||||
|
\end{beamercolorbox}
|
||||||
|
}
|
||||||
|
\AtBeginPart{
|
||||||
|
\frame{\partpage}
|
||||||
|
}
|
||||||
|
\AtBeginSection{
|
||||||
|
\ifbibliography
|
||||||
|
\else
|
||||||
|
\frame{\sectionpage}
|
||||||
|
\fi
|
||||||
|
}
|
||||||
|
\AtBeginSubsection{
|
||||||
|
\frame{\subsectionpage}
|
||||||
|
}
|
||||||
|
$endif$
|
||||||
|
$endif$
|
||||||
|
$if(beamerarticle)$
|
||||||
|
\usepackage{beamerarticle} % needs to be loaded first
|
||||||
|
$endif$
|
||||||
|
$if(fontfamily)$
|
||||||
|
\usepackage[$for(fontfamilyoptions)$$fontfamilyoptions$$sep$,$endfor$]{$fontfamily$}
|
||||||
|
$else$
|
||||||
|
\usepackage{lmodern}
|
||||||
|
$endif$
|
||||||
|
$if(linestretch)$
|
||||||
|
\usepackage{setspace}
|
||||||
|
\setstretch{$linestretch$}
|
||||||
|
$else$
|
||||||
|
\usepackage{setspace}
|
||||||
|
\setstretch{1.2}
|
||||||
|
$endif$
|
||||||
|
\usepackage{amssymb,amsmath}
|
||||||
|
\usepackage{ifxetex,ifluatex}
|
||||||
|
\usepackage{fixltx2e} % provides \textsubscript
|
||||||
|
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
|
||||||
|
\usepackage[$if(fontenc)$$fontenc$$else$T1$endif$]{fontenc}
|
||||||
|
\usepackage[utf8]{inputenc}
|
||||||
|
\usepackage{textcomp} % provides euro and other symbols
|
||||||
|
\else % if luatex or xelatex
|
||||||
|
$if(mathspec)$
|
||||||
|
\ifxetex
|
||||||
|
\usepackage{mathspec}
|
||||||
|
\else
|
||||||
|
\usepackage{unicode-math}
|
||||||
|
\fi
|
||||||
|
$else$
|
||||||
|
\usepackage{unicode-math}
|
||||||
|
$endif$
|
||||||
|
\defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
|
||||||
|
$for(fontfamilies)$
|
||||||
|
\newfontfamily{$fontfamilies.name$}[$fontfamilies.options$]{$fontfamilies.font$}
|
||||||
|
$endfor$
|
||||||
|
$if(mainfont)$
|
||||||
|
\setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$}
|
||||||
|
$endif$
|
||||||
|
$if(sansfont)$
|
||||||
|
\setsansfont[$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$]{$sansfont$}
|
||||||
|
$endif$
|
||||||
|
$if(monofont)$
|
||||||
|
\setmonofont[Mapping=tex-ansi$if(monofontoptions)$,$for(monofontoptions)$$monofontoptions$$sep$,$endfor$$endif$]{$monofont$}
|
||||||
|
$endif$
|
||||||
|
$if(mathfont)$
|
||||||
|
$if(mathspec)$
|
||||||
|
\ifxetex
|
||||||
|
\setmathfont(Digits,Latin,Greek)[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
|
||||||
|
\else
|
||||||
|
\setmathfont[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
|
||||||
|
\fi
|
||||||
|
$else$
|
||||||
|
\setmathfont[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
|
||||||
|
$endif$
|
||||||
|
$endif$
|
||||||
|
$if(CJKmainfont)$
|
||||||
|
\ifxetex
|
||||||
|
\usepackage{xeCJK}
|
||||||
|
\setCJKmainfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$}
|
||||||
|
\fi
|
||||||
|
$endif$
|
||||||
|
$if(luatexjapresetoptions)$
|
||||||
|
\ifluatex
|
||||||
|
\usepackage[$for(luatexjapresetoptions)$$luatexjapresetoptions$$sep$,$endfor$]{luatexja-preset}
|
||||||
|
\fi
|
||||||
|
$endif$
|
||||||
|
$if(CJKmainfont)$
|
||||||
|
\ifluatex
|
||||||
|
\usepackage[$for(luatexjafontspecoptions)$$luatexjafontspecoptions$$sep$,$endfor$]{luatexja-fontspec}
|
||||||
|
\setmainjfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$}
|
||||||
|
\fi
|
||||||
|
$endif$
|
||||||
|
\fi
|
||||||
|
$if(beamer)$
|
||||||
|
$if(theme)$
|
||||||
|
\usetheme[$for(themeoptions)$$themeoptions$$sep$,$endfor$]{$theme$}
|
||||||
|
$endif$
|
||||||
|
$if(colortheme)$
|
||||||
|
\usecolortheme{$colortheme$}
|
||||||
|
$endif$
|
||||||
|
$if(fonttheme)$
|
||||||
|
\usefonttheme{$fonttheme$}
|
||||||
|
$endif$
|
||||||
|
$if(mainfont)$
|
||||||
|
\usefonttheme{serif} % use mainfont rather than sansfont for slide text
|
||||||
|
$endif$
|
||||||
|
$if(innertheme)$
|
||||||
|
\useinnertheme{$innertheme$}
|
||||||
|
$endif$
|
||||||
|
$if(outertheme)$
|
||||||
|
\useoutertheme{$outertheme$}
|
||||||
|
$endif$
|
||||||
|
$endif$
|
||||||
|
% use upquote if available, for straight quotes in verbatim environments
|
||||||
|
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
|
||||||
|
% use microtype if available
|
||||||
|
\IfFileExists{microtype.sty}{%
|
||||||
|
\usepackage[$for(microtypeoptions)$$microtypeoptions$$sep$,$endfor$]{microtype}
|
||||||
|
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
|
||||||
|
}{}
|
||||||
|
$if(indent)$
|
||||||
|
$else$
|
||||||
|
\IfFileExists{parskip.sty}{%
|
||||||
|
\usepackage{parskip}
|
||||||
|
}{% else
|
||||||
|
\setlength{\parindent}{0pt}
|
||||||
|
\setlength{\parskip}{6pt plus 2pt minus 1pt}
|
||||||
|
}
|
||||||
|
$endif$
|
||||||
|
$if(verbatim-in-note)$
|
||||||
|
\usepackage{fancyvrb}
|
||||||
|
$endif$
|
||||||
|
$if(colorlinks)$
|
||||||
|
\usepackage{xcolor}
|
||||||
|
\definecolor{default-linkcolor}{HTML}{A50000}
|
||||||
|
\definecolor{default-filecolor}{HTML}{A50000}
|
||||||
|
\definecolor{default-citecolor}{HTML}{4077C0}
|
||||||
|
\definecolor{default-urlcolor}{HTML}{4077C0}
|
||||||
|
$endif$
|
||||||
|
\usepackage{hyperref}
|
||||||
|
\hypersetup{
|
||||||
|
$if(title-meta)$
|
||||||
|
pdftitle={$title-meta$},
|
||||||
|
$endif$
|
||||||
|
$if(author-meta)$
|
||||||
|
pdfauthor={$author-meta$},
|
||||||
|
$endif$
|
||||||
|
$if(subject)$
|
||||||
|
pdfsubject={$subject$},
|
||||||
|
$endif$
|
||||||
|
$if(keywords)$
|
||||||
|
pdfkeywords={$for(keywords)$$keywords$$sep$, $endfor$},
|
||||||
|
$endif$
|
||||||
|
$if(colorlinks)$
|
||||||
|
colorlinks=true,
|
||||||
|
linkcolor=$if(linkcolor)$$linkcolor$$else$default-linkcolor$endif$,
|
||||||
|
filecolor=$if(filecolor)$$filecolor$$else$default-filecolor$endif$,
|
||||||
|
citecolor=$if(citecolor)$$citecolor$$else$default-citecolor$endif$,
|
||||||
|
urlcolor=$if(urlcolor)$$urlcolor$$else$default-urlcolor$endif$,
|
||||||
|
$else$
|
||||||
|
pdfborder={0 0 0},
|
||||||
|
$endif$
|
||||||
|
breaklinks=true}
|
||||||
|
\urlstyle{same} % don't use monospace font for urls
|
||||||
|
$if(verbatim-in-note)$
|
||||||
|
\VerbatimFootnotes % allows verbatim text in footnotes
|
||||||
|
$endif$
|
||||||
|
$if(geometry)$
|
||||||
|
\usepackage[margin=2.5cm,includehead=true,includefoot=true,centering,$for(geometry)$$geometry$$sep$,$endfor$]{geometry}
|
||||||
|
$else$
|
||||||
|
\usepackage[margin=2.5cm,includehead=true,includefoot=true,centering]{geometry}
|
||||||
|
$endif$
|
||||||
|
$if(logo)$
|
||||||
|
\usepackage[export]{adjustbox}
|
||||||
|
\usepackage{graphicx}
|
||||||
|
$endif$
|
||||||
|
$if(beamer)$
|
||||||
|
\newif\ifbibliography
|
||||||
|
$endif$
|
||||||
|
$if(listings)$
|
||||||
|
\usepackage{listings}
|
||||||
|
\newcommand{\passthrough}[1]{#1}
|
||||||
|
$endif$
|
||||||
|
$if(lhs)$
|
||||||
|
\lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}
|
||||||
|
$endif$
|
||||||
|
$if(highlighting-macros)$
|
||||||
|
$highlighting-macros$
|
||||||
|
$endif$
|
||||||
|
$if(tables)$
|
||||||
|
\usepackage{longtable,booktabs}
|
||||||
|
$if(beamer)$
|
||||||
|
\usepackage{caption}
|
||||||
|
% These lines are needed to make table captions work with longtable:
|
||||||
|
\makeatletter
|
||||||
|
\def\fnum@table{\tablename~\thetable}
|
||||||
|
\makeatother
|
||||||
|
$else$
|
||||||
|
% Fix footnotes in tables (requires footnote package)
|
||||||
|
\IfFileExists{footnote.sty}{\usepackage{footnote}\makesavenoteenv{longtable}}{}
|
||||||
|
$endif$
|
||||||
|
$endif$
|
||||||
|
$if(graphics)$
|
||||||
|
\usepackage{graphicx,grffile}
|
||||||
|
\makeatletter
|
||||||
|
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
|
||||||
|
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
|
||||||
|
\makeatother
|
||||||
|
% Scale images if necessary, so that they will not overflow the page
|
||||||
|
% margins by default, and it is still possible to overwrite the defaults
|
||||||
|
% using explicit options in \includegraphics[width, height, ...]{}
|
||||||
|
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
|
||||||
|
$endif$
|
||||||
|
$if(links-as-notes)$
|
||||||
|
% Make links footnotes instead of hotlinks:
|
||||||
|
\DeclareRobustCommand{\href}[2]{#2\footnote{\url{#1}}}
|
||||||
|
$endif$
|
||||||
|
$if(strikeout)$
|
||||||
|
\usepackage[normalem]{ulem}
|
||||||
|
% avoid problems with \sout in headers with hyperref:
|
||||||
|
\pdfstringdefDisableCommands{\renewcommand{\sout}{}}
|
||||||
|
$endif$
|
||||||
|
\setlength{\emergencystretch}{3em} % prevent overfull lines
|
||||||
|
\providecommand{\tightlist}{%
|
||||||
|
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
|
||||||
|
$if(numbersections)$
|
||||||
|
\setcounter{secnumdepth}{$if(secnumdepth)$$secnumdepth$$else$5$endif$}
|
||||||
|
$else$
|
||||||
|
\setcounter{secnumdepth}{0}
|
||||||
|
$endif$
|
||||||
|
$if(beamer)$
|
||||||
|
$else$
|
||||||
|
$if(subparagraph)$
|
||||||
|
$else$
|
||||||
|
% Redefines (sub)paragraphs to behave more like sections
|
||||||
|
\ifx\paragraph\undefined\else
|
||||||
|
\let\oldparagraph\paragraph
|
||||||
|
\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
|
||||||
|
\fi
|
||||||
|
\ifx\subparagraph\undefined\else
|
||||||
|
\let\oldsubparagraph\subparagraph
|
||||||
|
\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
|
||||||
|
\fi
|
||||||
|
$endif$
|
||||||
|
$endif$
|
||||||
|
$if(pagestyle)$
|
||||||
|
\pagestyle{$pagestyle$}
|
||||||
|
$endif$
|
||||||
|
|
||||||
|
% Make use of float-package and set default placement for figures to H
|
||||||
|
\usepackage{float}
|
||||||
|
\floatplacement{figure}{H}
|
||||||
|
|
||||||
|
$for(header-includes)$
|
||||||
|
$header-includes$
|
||||||
|
$endfor$
|
||||||
|
$if(lang)$
|
||||||
|
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
|
||||||
|
\usepackage[shorthands=off,$for(babel-otherlangs)$$babel-otherlangs$,$endfor$main=$babel-lang$]{babel}
|
||||||
|
$if(babel-newcommands)$
|
||||||
|
$babel-newcommands$
|
||||||
|
$endif$
|
||||||
|
\else
|
||||||
|
$if(mainfont)$
|
||||||
|
$else$
|
||||||
|
% See issue https://github.com/reutenauer/polyglossia/issues/127
|
||||||
|
\renewcommand*\familydefault{\sfdefault}
|
||||||
|
$endif$
|
||||||
|
% load polyglossia as late as possible as it *could* call bidi if RTL lang (e.g. Hebrew or Arabic)
|
||||||
|
\usepackage{polyglossia}
|
||||||
|
\setmainlanguage[$polyglossia-lang.options$]{$polyglossia-lang.name$}
|
||||||
|
$for(polyglossia-otherlangs)$
|
||||||
|
\setotherlanguage[$polyglossia-otherlangs.options$]{$polyglossia-otherlangs.name$}
|
||||||
|
$endfor$
|
||||||
|
\fi
|
||||||
|
$endif$
|
||||||
|
$if(dir)$
|
||||||
|
\ifxetex
|
||||||
|
% load bidi as late as possible as it modifies e.g. graphicx
|
||||||
|
\usepackage{bidi}
|
||||||
|
\fi
|
||||||
|
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
|
||||||
|
\TeXXeTstate=1
|
||||||
|
\newcommand{\RL}[1]{\beginR #1\endR}
|
||||||
|
\newcommand{\LR}[1]{\beginL #1\endL}
|
||||||
|
\newenvironment{RTL}{\beginR}{\endR}
|
||||||
|
\newenvironment{LTR}{\beginL}{\endL}
|
||||||
|
\fi
|
||||||
|
$endif$
|
||||||
|
$if(natbib)$
|
||||||
|
\usepackage[$natbiboptions$]{natbib}
|
||||||
|
\bibliographystyle{$if(biblio-style)$$biblio-style$$else$plainnat$endif$}
|
||||||
|
$endif$
|
||||||
|
$if(biblatex)$
|
||||||
|
\usepackage[$if(biblio-style)$style=$biblio-style$,$endif$$for(biblatexoptions)$$biblatexoptions$$sep$,$endfor$]{biblatex}
|
||||||
|
$for(bibliography)$
|
||||||
|
\addbibresource{$bibliography$}
|
||||||
|
$endfor$
|
||||||
|
$endif$
|
||||||
|
|
||||||
|
$if(title)$
|
||||||
|
\title{$title$$if(thanks)$\thanks{$thanks$}$endif$}
|
||||||
|
$endif$
|
||||||
|
$if(subtitle)$
|
||||||
|
\providecommand{\subtitle}[1]{}
|
||||||
|
\subtitle{$subtitle$}
|
||||||
|
$endif$
|
||||||
|
$if(author)$
|
||||||
|
\author{$for(author)$$author$$sep$ \and $endfor$}
|
||||||
|
$endif$
|
||||||
|
$if(institute)$
|
||||||
|
\providecommand{\institute}[1]{}
|
||||||
|
\institute{$for(institute)$$institute$$sep$ \and $endfor$}
|
||||||
|
$endif$
|
||||||
|
\date{$date$}
|
||||||
|
$if(beamer)$
|
||||||
|
$if(titlegraphic)$
|
||||||
|
\titlegraphic{\includegraphics{$titlegraphic$}}
|
||||||
|
$endif$
|
||||||
|
$if(logo)$
|
||||||
|
\logo{\includegraphics{$logo$}}
|
||||||
|
$endif$
|
||||||
|
$endif$
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%%
|
||||||
|
%% added
|
||||||
|
%%
|
||||||
|
|
||||||
|
%
|
||||||
|
% No language specified? take American English.
|
||||||
|
%
|
||||||
|
$if(lang)$$else$
|
||||||
|
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
|
||||||
|
\usepackage[shorthands=off,$for(babel-otherlangs)$$babel-otherlangs$,$endfor$main=english]{babel}
|
||||||
|
$if(babel-newcommands)$
|
||||||
|
$babel-newcommands$
|
||||||
|
$endif$
|
||||||
|
\else
|
||||||
|
$if(mainfont)$
|
||||||
|
$else$
|
||||||
|
% See issue https://github.com/reutenauer/polyglossia/issues/127
|
||||||
|
\renewcommand*\familydefault{\sfdefault}
|
||||||
|
$endif$
|
||||||
|
% load polyglossia as late as possible as it *could* call bidi if RTL lang (e.g. Hebrew or Arabic)
|
||||||
|
\usepackage{polyglossia}
|
||||||
|
\setmainlanguage[]{english}
|
||||||
|
$for(polyglossia-otherlangs)$
|
||||||
|
\setotherlanguage[$polyglossia-otherlangs.options$]{$polyglossia-otherlangs.name$}
|
||||||
|
$endfor$
|
||||||
|
\fi
|
||||||
|
$endif$
|
||||||
|
|
||||||
|
%
|
||||||
|
% colors
|
||||||
|
%
|
||||||
|
\usepackage[]{xcolor}
|
||||||
|
|
||||||
|
%
|
||||||
|
% listing colors
|
||||||
|
%
|
||||||
|
\definecolor{listing-background}{HTML}{F7F7F7}
|
||||||
|
\definecolor{listing-rule}{HTML}{B3B2B3}
|
||||||
|
\definecolor{listing-numbers}{HTML}{B3B2B3}
|
||||||
|
\definecolor{listing-text-color}{HTML}{000000}
|
||||||
|
\definecolor{listing-keyword}{HTML}{435489}
|
||||||
|
\definecolor{listing-identifier}{HTML}{435489}
|
||||||
|
\definecolor{listing-string}{HTML}{00999A}
|
||||||
|
\definecolor{listing-comment}{HTML}{8E8E8E}
|
||||||
|
\definecolor{listing-javadoc-comment}{HTML}{006CA9}
|
||||||
|
|
||||||
|
%\definecolor{listing-background}{rgb}{0.97,0.97,0.97}
|
||||||
|
%\definecolor{listing-rule}{HTML}{B3B2B3}
|
||||||
|
%\definecolor{listing-numbers}{HTML}{B3B2B3}
|
||||||
|
%\definecolor{listing-text-color}{HTML}{000000}
|
||||||
|
%\definecolor{listing-keyword}{HTML}{D8006B}
|
||||||
|
%\definecolor{listing-identifier}{HTML}{000000}
|
||||||
|
%\definecolor{listing-string}{HTML}{006CA9}
|
||||||
|
%\definecolor{listing-comment}{rgb}{0.25,0.5,0.35}
|
||||||
|
%\definecolor{listing-javadoc-comment}{HTML}{006CA9}
|
||||||
|
|
||||||
|
%
|
||||||
|
% for the background color of the title page
|
||||||
|
%
|
||||||
|
$if(titlepage)$
|
||||||
|
\usepackage{pagecolor}
|
||||||
|
\usepackage{afterpage}
|
||||||
|
$endif$
|
||||||
|
|
||||||
|
%
|
||||||
|
% TOC depth and
|
||||||
|
% section numbering depth
|
||||||
|
%
|
||||||
|
\setcounter{tocdepth}{3}
|
||||||
|
$if(numbersections)$
|
||||||
|
\setcounter{secnumdepth}{3}
|
||||||
|
$endif$
|
||||||
|
|
||||||
|
%
|
||||||
|
% break urls
|
||||||
|
%
|
||||||
|
\PassOptionsToPackage{hyphens}{url}
|
||||||
|
|
||||||
|
%
|
||||||
|
% When using babel or polyglossia with biblatex, loading csquotes is recommended
|
||||||
|
% to ensure that quoted texts are typeset according to the rules of your main language.
|
||||||
|
%
|
||||||
|
\usepackage{csquotes}
|
||||||
|
|
||||||
|
%
|
||||||
|
% captions
|
||||||
|
%
|
||||||
|
\definecolor{caption-color}{HTML}{777777}
|
||||||
|
\usepackage[font={stretch=1.2}, textfont={color=caption-color}, position=top, skip=4mm, labelfont=bf, singlelinecheck=false, justification=$if(caption-justification)$$caption-justification$$else$raggedright$endif$]{caption}
|
||||||
|
\setcapindent{0em}
|
||||||
|
\captionsetup[longtable]{position=above}
|
||||||
|
|
||||||
|
%
|
||||||
|
% blockquote
|
||||||
|
%
|
||||||
|
\definecolor{blockquote-border}{RGB}{221,221,221}
|
||||||
|
\definecolor{blockquote-text}{RGB}{119,119,119}
|
||||||
|
\usepackage{mdframed}
|
||||||
|
\newmdenv[rightline=false,bottomline=false,topline=false,linewidth=3pt,linecolor=blockquote-border,skipabove=\parskip]{customblockquote}
|
||||||
|
\renewenvironment{quote}{\begin{customblockquote}\list{}{\rightmargin=0em\leftmargin=0em}%
|
||||||
|
\item\relax\color{blockquote-text}\ignorespaces}{\unskip\unskip\endlist\end{customblockquote}}
|
||||||
|
|
||||||
|
%
|
||||||
|
% Source Sans Pro as the default font family
|
||||||
|
% Source Code Pro for monospace text
|
||||||
|
%
|
||||||
|
% 'default' option sets the default
|
||||||
|
% font family to Source Sans Pro, not \sfdefault.
|
||||||
|
%
|
||||||
|
$if(mainfont)$
|
||||||
|
$else$
|
||||||
|
\usepackage[default]{sourcesanspro}
|
||||||
|
\usepackage{sourcecodepro}
|
||||||
|
$endif$
|
||||||
|
|
||||||
|
%
|
||||||
|
% heading color
|
||||||
|
%
|
||||||
|
\definecolor{heading-color}{RGB}{40,40,40}
|
||||||
|
\addtokomafont{section}{\color{heading-color}}
|
||||||
|
% When using the classes report, scrreprt, book,
|
||||||
|
% scrbook or memoir, uncomment the following line.
|
||||||
|
%\addtokomafont{chapter}{\color{heading-color}}
|
||||||
|
|
||||||
|
%
|
||||||
|
% variables for title and author
|
||||||
|
%
|
||||||
|
\usepackage{titling}
|
||||||
|
\title{$title$}
|
||||||
|
\author{$for(author)$$author$$sep$, $endfor$}
|
||||||
|
|
||||||
|
%
|
||||||
|
% tables
|
||||||
|
%
|
||||||
|
$if(tables)$
|
||||||
|
|
||||||
|
\definecolor{table-row-color}{HTML}{F5F5F5}
|
||||||
|
\definecolor{table-rule-color}{HTML}{999999}
|
||||||
|
|
||||||
|
%\arrayrulecolor{black!40}
|
||||||
|
\arrayrulecolor{table-rule-color} % color of \toprule, \midrule, \bottomrule
|
||||||
|
\setlength\heavyrulewidth{0.3ex} % thickness of \toprule, \bottomrule
|
||||||
|
\renewcommand{\arraystretch}{1.3} % spacing (padding)
|
||||||
|
|
||||||
|
% Reset rownum counter so that each table
|
||||||
|
% starts with the same row colors.
|
||||||
|
% https://tex.stackexchange.com/questions/170637/restarting-rowcolors
|
||||||
|
\let\oldlongtable\longtable
|
||||||
|
\let\endoldlongtable\endlongtable
|
||||||
|
\renewenvironment{longtable}{
|
||||||
|
\rowcolors{3}{}{table-row-color!100} % row color
|
||||||
|
\oldlongtable} {
|
||||||
|
\endoldlongtable
|
||||||
|
\global\rownum=0\relax}
|
||||||
|
|
||||||
|
% Unfortunately the colored cells extend beyond the edge of the
|
||||||
|
% table because pandoc uses @-expressions (@{}) like so:
|
||||||
|
%
|
||||||
|
% \begin{longtable}[]{@{}ll@{}}
|
||||||
|
% \end{longtable}
|
||||||
|
%
|
||||||
|
% https://en.wikibooks.org/wiki/LaTeX/Tables#.40-expressions
|
||||||
|
$endif$
|
||||||
|
|
||||||
|
%
|
||||||
|
% remove paragraph indention
|
||||||
|
%
|
||||||
|
\setlength{\parindent}{0pt}
|
||||||
|
\setlength{\parskip}{6pt plus 2pt minus 1pt}
|
||||||
|
\setlength{\emergencystretch}{3em} % prevent overfull lines
|
||||||
|
|
||||||
|
%
|
||||||
|
%
|
||||||
|
% Listings
|
||||||
|
%
|
||||||
|
%
|
||||||
|
|
||||||
|
$if(listings)$
|
||||||
|
\lstdefinestyle{eisvogel_listing_style}{
|
||||||
|
language = java,
|
||||||
|
$if(listings-disable-line-numbers)$
|
||||||
|
xleftmargin = 0.6em,
|
||||||
|
framexleftmargin = 0.4em,
|
||||||
|
$else$
|
||||||
|
numbers = left,
|
||||||
|
xleftmargin = 2.7em,
|
||||||
|
framexleftmargin = 2.5em,
|
||||||
|
$endif$
|
||||||
|
backgroundcolor = \color{listing-background},
|
||||||
|
basicstyle = \color{listing-text-color}\small\ttfamily{}\linespread{1.15}, % print whole listing small
|
||||||
|
breaklines = true,
|
||||||
|
frame = single,
|
||||||
|
framesep = 0.6mm,
|
||||||
|
rulecolor = \color{listing-rule},
|
||||||
|
frameround = ffff,
|
||||||
|
tabsize = 4,
|
||||||
|
numberstyle = \color{listing-numbers},
|
||||||
|
aboveskip = 1.0em,
|
||||||
|
belowcaptionskip = 1.0em,
|
||||||
|
keywordstyle = \color{listing-keyword}\bfseries,
|
||||||
|
classoffset = 0,
|
||||||
|
sensitive = true,
|
||||||
|
identifierstyle = \color{listing-identifier},
|
||||||
|
commentstyle = \color{listing-comment},
|
||||||
|
morecomment = [s][\color{listing-javadoc-comment}]{/**}{*/},
|
||||||
|
stringstyle = \color{listing-string},
|
||||||
|
showstringspaces = false,
|
||||||
|
escapeinside = {/*@}{@*/}, % Allow LaTeX inside these special comments
|
||||||
|
literate =
|
||||||
|
{á}{{\'a}}1 {é}{{\'e}}1 {í}{{\'i}}1 {ó}{{\'o}}1 {ú}{{\'u}}1
|
||||||
|
{Á}{{\'A}}1 {É}{{\'E}}1 {Í}{{\'I}}1 {Ó}{{\'O}}1 {Ú}{{\'U}}1
|
||||||
|
{à}{{\`a}}1 {è}{{\'e}}1 {ì}{{\`i}}1 {ò}{{\`o}}1 {ù}{{\`u}}1
|
||||||
|
{À}{{\`A}}1 {È}{{\'E}}1 {Ì}{{\`I}}1 {Ò}{{\`O}}1 {Ù}{{\`U}}1
|
||||||
|
{ä}{{\"a}}1 {ë}{{\"e}}1 {ï}{{\"i}}1 {ö}{{\"o}}1 {ü}{{\"u}}1
|
||||||
|
{Ä}{{\"A}}1 {Ë}{{\"E}}1 {Ï}{{\"I}}1 {Ö}{{\"O}}1 {Ü}{{\"U}}1
|
||||||
|
{â}{{\^a}}1 {ê}{{\^e}}1 {î}{{\^i}}1 {ô}{{\^o}}1 {û}{{\^u}}1
|
||||||
|
{Â}{{\^A}}1 {Ê}{{\^E}}1 {Î}{{\^I}}1 {Ô}{{\^O}}1 {Û}{{\^U}}1
|
||||||
|
{œ}{{\oe}}1 {Œ}{{\OE}}1 {æ}{{\ae}}1 {Æ}{{\AE}}1 {ß}{{\ss}}1
|
||||||
|
{ç}{{\c c}}1 {Ç}{{\c C}}1 {ø}{{\o}}1 {å}{{\r a}}1 {Å}{{\r A}}1
|
||||||
|
{€}{{\EUR}}1 {£}{{\pounds}}1 {«}{{\guillemotleft}}1
|
||||||
|
{»}{{\guillemotright}}1 {ñ}{{\~n}}1 {Ñ}{{\~N}}1 {¿}{{?`}}1
|
||||||
|
{…}{{\ldots}}1 {≥}{{>=}}1 {≤}{{<=}}1 {„}{{\glqq}}1 {“}{{\grqq}}1
|
||||||
|
{”}{{''}}1
|
||||||
|
}
|
||||||
|
\lstset{style=eisvogel_listing_style}
|
||||||
|
|
||||||
|
\lstdefinelanguage{XML}{
|
||||||
|
morestring = [b]",
|
||||||
|
moredelim = [s][\bfseries\color{listing-keyword}]{<}{\ },
|
||||||
|
moredelim = [s][\bfseries\color{listing-keyword}]{</}{>},
|
||||||
|
moredelim = [l][\bfseries\color{listing-keyword}]{/>},
|
||||||
|
moredelim = [l][\bfseries\color{listing-keyword}]{>},
|
||||||
|
morecomment = [s]{<?}{?>},
|
||||||
|
morecomment = [s]{<!--}{-->},
|
||||||
|
commentstyle = \color{listing-comment},
|
||||||
|
stringstyle = \color{listing-string},
|
||||||
|
identifierstyle = \color{listing-identifier}
|
||||||
|
}
|
||||||
|
$endif$
|
||||||
|
|
||||||
|
%
|
||||||
|
% header and footer
|
||||||
|
%
|
||||||
|
$if(disable-header-and-footer)$
|
||||||
|
$else$
|
||||||
|
\usepackage{fancyhdr}
|
||||||
|
\pagestyle{fancy}
|
||||||
|
\fancyhead{}
|
||||||
|
\fancyfoot{}
|
||||||
|
\lhead[$if(header-right)$$header-right$$else$$date$$endif$]{$if(header-left)$$header-left$$else$$title$$endif$}
|
||||||
|
\chead[$if(header-center)$$header-center$$else$$endif$]{$if(header-center)$$header-center$$else$$endif$}
|
||||||
|
\rhead[$if(header-left)$$header-left$$else$$title$$endif$]{$if(header-right)$$header-right$$else$$date$$endif$}
|
||||||
|
\lfoot[$if(footer-right)$$footer-right$$else$\thepage$endif$]{$if(footer-left)$$footer-left$$else$$for(author)$$author$$sep$, $endfor$$endif$}
|
||||||
|
\cfoot[$if(footer-center)$$footer-center$$else$$endif$]{$if(footer-center)$$footer-center$$else$$endif$}
|
||||||
|
\rfoot[$if(footer-left)$$footer-left$$else$$for(author)$$author$$sep$, $endfor$$endif$]{$if(footer-right)$$footer-right$$else$\thepage$endif$}
|
||||||
|
\renewcommand{\headrulewidth}{0.4pt}
|
||||||
|
\renewcommand{\footrulewidth}{0.4pt}
|
||||||
|
$endif$
|
||||||
|
|
||||||
|
%%
|
||||||
|
%% end added
|
||||||
|
%%
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
|
||||||
|
%%
|
||||||
|
%% begin titlepage
|
||||||
|
%%
|
||||||
|
|
||||||
|
$if(titlepage)$
|
||||||
|
\begin{titlepage}
|
||||||
|
\newgeometry{left=6cm}
|
||||||
|
$if(titlepage-color)$
|
||||||
|
\definecolor{titlepage-color}{HTML}{$titlepage-color$}
|
||||||
|
\newpagecolor{titlepage-color}\afterpage{\restorepagecolor}
|
||||||
|
$endif$
|
||||||
|
\newcommand{\colorRule}[3][black]{\textcolor[HTML]{#1}{\rule{#2}{#3}}}
|
||||||
|
\begin{flushleft}
|
||||||
|
\noindent
|
||||||
|
\\[-1em]
|
||||||
|
\color[HTML]{$if(titlepage-text-color)$$titlepage-text-color$$else$5F5F5F$endif$}
|
||||||
|
\makebox[0pt][l]{\colorRule[$if(titlepage-rule-color)$$titlepage-rule-color$$else$435488$endif$]{1.3\textwidth}{$if(titlepage-rule-height)$$titlepage-rule-height$$else$4$endif$pt}}
|
||||||
|
\par
|
||||||
|
\noindent
|
||||||
|
|
||||||
|
{ \setstretch{1.4}
|
||||||
|
\vfill
|
||||||
|
\noindent {\huge \textbf{\textsf{$title$}}}
|
||||||
|
$if(subtitle)$
|
||||||
|
\vskip 1em
|
||||||
|
{\Large \textsf{$subtitle$}}
|
||||||
|
$endif$
|
||||||
|
\vskip 2em
|
||||||
|
\noindent
|
||||||
|
{\Large \textsf{$for(author)$$author$$sep$, $endfor$}
|
||||||
|
\vfill
|
||||||
|
}
|
||||||
|
|
||||||
|
$if(logo)$
|
||||||
|
\noindent
|
||||||
|
\includegraphics[width=$if(logo-width)$$logo-width$$else$100$endif$pt, left]{$logo$}
|
||||||
|
$endif$
|
||||||
|
|
||||||
|
\textsf{$date$}}
|
||||||
|
\end{flushleft}
|
||||||
|
\end{titlepage}
|
||||||
|
\restoregeometry
|
||||||
|
$endif$
|
||||||
|
|
||||||
|
%%
|
||||||
|
%% end titlepage
|
||||||
|
%%
|
||||||
|
|
||||||
|
$if(title)$
|
||||||
|
$if(beamer)$
|
||||||
|
\frame{\titlepage}
|
||||||
|
$endif$
|
||||||
|
$if(abstract)$
|
||||||
|
\begin{abstract}
|
||||||
|
$abstract$
|
||||||
|
\end{abstract}
|
||||||
|
$endif$
|
||||||
|
$endif$
|
||||||
|
|
||||||
|
$for(include-before)$
|
||||||
|
$include-before$
|
||||||
|
|
||||||
|
$endfor$
|
||||||
|
$if(toc)$
|
||||||
|
$if(toc-title)$
|
||||||
|
\renewcommand*\contentsname{$toc-title$}
|
||||||
|
$endif$
|
||||||
|
$if(beamer)$
|
||||||
|
\begin{frame}
|
||||||
|
$if(toc-title)$
|
||||||
|
\frametitle{$toc-title$}
|
||||||
|
$endif$
|
||||||
|
\tableofcontents[hideallsubsections]
|
||||||
|
\end{frame}
|
||||||
|
$if(toc-own-page)$
|
||||||
|
\newpage
|
||||||
|
$endif$
|
||||||
|
$else$
|
||||||
|
{
|
||||||
|
$if(colorlinks)$
|
||||||
|
\hypersetup{linkcolor=$if(toccolor)$$toccolor$$else$$endif$}
|
||||||
|
$endif$
|
||||||
|
\setcounter{tocdepth}{$toc-depth$}
|
||||||
|
\tableofcontents
|
||||||
|
$if(toc-own-page)$
|
||||||
|
\newpage
|
||||||
|
$endif$
|
||||||
|
}
|
||||||
|
$endif$
|
||||||
|
$endif$
|
||||||
|
$if(lot)$
|
||||||
|
\listoftables
|
||||||
|
$endif$
|
||||||
|
$if(lof)$
|
||||||
|
\listoffigures
|
||||||
|
$endif$
|
||||||
|
$body$
|
||||||
|
|
||||||
|
$if(natbib)$
|
||||||
|
$if(bibliography)$
|
||||||
|
$if(biblio-title)$
|
||||||
|
$if(book-class)$
|
||||||
|
\renewcommand\bibname{$biblio-title$}
|
||||||
|
$else$
|
||||||
|
\renewcommand\refname{$biblio-title$}
|
||||||
|
$endif$
|
||||||
|
$endif$
|
||||||
|
$if(beamer)$
|
||||||
|
\begin{frame}[allowframebreaks]{$biblio-title$}
|
||||||
|
\bibliographytrue
|
||||||
|
$endif$
|
||||||
|
\bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$}
|
||||||
|
$if(beamer)$
|
||||||
|
\end{frame}
|
||||||
|
$endif$
|
||||||
|
|
||||||
|
$endif$
|
||||||
|
$endif$
|
||||||
|
$if(biblatex)$
|
||||||
|
$if(beamer)$
|
||||||
|
\begin{frame}[allowframebreaks]{$biblio-title$}
|
||||||
|
\bibliographytrue
|
||||||
|
\printbibliography[heading=none]
|
||||||
|
\end{frame}
|
||||||
|
$else$
|
||||||
|
\printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$
|
||||||
|
$endif$
|
||||||
|
|
||||||
|
$endif$
|
||||||
|
$for(include-after)$
|
||||||
|
$include-after$
|
||||||
|
|
||||||
|
$endfor$
|
||||||
|
\end{document}
|
122
templates/mindoc.html
Normal file
122
templates/mindoc.html
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html$if(lang)$ lang="$lang$"$endif$$if(dir)$ dir="$dir$"$endif$>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="generator" content="pandoc">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
$if(description)$
|
||||||
|
<meta name="description" content="$description$">
|
||||||
|
$endif$
|
||||||
|
$for(author-meta)$
|
||||||
|
<meta name="author" content="$author-meta$">
|
||||||
|
$endfor$
|
||||||
|
$if(date-meta)$
|
||||||
|
<meta name="dcterms.date" content="$date-meta$">
|
||||||
|
$endif$
|
||||||
|
<title>$if(title-prefix)$$title-prefix$ - $endif$$pagetitle$</title>
|
||||||
|
|
||||||
|
<!-- Yahoo! CDN combo URL for selected Pure.css modules -->
|
||||||
|
<link rel="stylesheet" href="http://yui.yahooapis.com/combo?pure/0.6.0/base-min.css&pure/0.6.0/grids-responsive-min.css&pure/0.6.0/menus-min.css&pure/0.6.0/tables-min.css">
|
||||||
|
|
||||||
|
<!-- Extra styles -->
|
||||||
|
<style>
|
||||||
|
body{margin:1em 0 0}.pure-g{padding:0 1em}.pure-menu-link:focus{background-color:#d3d3d3}nav{margin:0 0 1em;padding:0 0 1em;border-bottom:1px solid #ccc}footer{margin:5em 0 1em}pre{white-space:pre-wrap;margin-left:3em}code{font-size:89%;color:#191919}.author{margin-bottom:0;padding-bottom:0}.headnote,.published,.license{font-size:89%;margin-bottom:.75em}@media screen and (max-width:35.5em){thead{display:none}tr,th,td{display:block}td{border-top:0}tr td:first-child{border-top:1px solid #ddd;font-weight:700}}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
$if(quotes)$
|
||||||
|
<style>q {quotes: "“" "”" "‘" "’";}</style>
|
||||||
|
$endif$
|
||||||
|
$if(highlighting-css)$
|
||||||
|
<style>
|
||||||
|
$highlighting-css$
|
||||||
|
</style>
|
||||||
|
$endif$
|
||||||
|
$for(css)$
|
||||||
|
<link rel="stylesheet" href="$css$">
|
||||||
|
$endfor$
|
||||||
|
$if(math)$
|
||||||
|
$math$
|
||||||
|
$endif$
|
||||||
|
$for(header-includes)$
|
||||||
|
$header-includes$
|
||||||
|
$endfor$
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<section id="page-content">
|
||||||
|
<div class="pure-g">
|
||||||
|
<div class="pure-u-1 pure-u-sm-1 pure-u-md-1 pure-u-lg-1 pure-u-xl-1">
|
||||||
|
|
||||||
|
<!-- page content begins here -->
|
||||||
|
|
||||||
|
$for(include-before)$
|
||||||
|
$include-before$
|
||||||
|
$endfor$
|
||||||
|
$if(headnote)$
|
||||||
|
<div class="headnote">$headnote$</div>
|
||||||
|
$endif$
|
||||||
|
$if(published)$
|
||||||
|
<div class="published">$published$</div>
|
||||||
|
$endif$
|
||||||
|
$if(license)$
|
||||||
|
<div class="license">$license$</div>$endif$
|
||||||
|
$if(title)$
|
||||||
|
<header>
|
||||||
|
<h1 class="title">$title$</h1>
|
||||||
|
$if(subtitle)$
|
||||||
|
<h1 class="subtitle">$subtitle$</h1>
|
||||||
|
$endif$
|
||||||
|
$if(author)$
|
||||||
|
$for(author)$
|
||||||
|
$if(author.name)$
|
||||||
|
<h2 class="author">$author.name$</h2>
|
||||||
|
$else$
|
||||||
|
<h2 class="author">$author$</h2>
|
||||||
|
$endif$
|
||||||
|
$if(author.affiliation)$
|
||||||
|
<div class="affiliation">$author.affiliation$</div>
|
||||||
|
$endif$
|
||||||
|
$if(author.email)$
|
||||||
|
<div class="email"><a href="mailto:$author.email$">$author.email$</a></div>
|
||||||
|
$endif$
|
||||||
|
$endfor$
|
||||||
|
$endif$
|
||||||
|
$if(version)$
|
||||||
|
<h3 class="version">Version $version$</h3>
|
||||||
|
$endif$
|
||||||
|
$if(date)$
|
||||||
|
<h3 class="date">$date$</h3>
|
||||||
|
$endif$
|
||||||
|
</header>
|
||||||
|
$endif$
|
||||||
|
$if(abstract)$
|
||||||
|
<div class="abstract">
|
||||||
|
<h3>Abstract</h3>
|
||||||
|
$abstract$
|
||||||
|
</div>
|
||||||
|
$endif$
|
||||||
|
$if(toc)$
|
||||||
|
<nav id="$idprefix$TOC">
|
||||||
|
$toc$
|
||||||
|
</nav>
|
||||||
|
$endif$
|
||||||
|
$body$
|
||||||
|
$for(include-after)$
|
||||||
|
$include-after$
|
||||||
|
$endfor$
|
||||||
|
|
||||||
|
<!-- page content ends here -->
|
||||||
|
|
||||||
|
</div> <!-- pure-u-1... -->
|
||||||
|
</div> <!-- pure-g -->
|
||||||
|
</section> <!-- page-content -->
|
||||||
|
<div class="pure-g">
|
||||||
|
<footer><a href="https://bitfragment.github.io/mindoc">mindoc</a> v1.1.0</footer>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
var mindoc=function(){function e(e){return e=e.toLowerCase(),e.charAt(0).toUpperCase()+e.substr(1)}function n(e){var n=new RegExp(/^\b[a-z]\S+\b-\b\S+\b/);return n.test(e)&&(e=e.replace(/-+/g," ")),e}function t(t){return t=n(t),e(t)}function r(e,n){return!!e.className.match(new RegExp("(\\s|^)"+n+"(\\s|)"))}function a(e,n){r(e,n)||(e.className+=" "+n)}function o(e,n){if(r(e,n)){var t=new RegExp("(\\s|^)"+n+"(\\s|)");e.className=e.className.replace(t," ")}}function u(){var e,n,t={table:"pure-table pure-table-bordered"};Object.keys(t).forEach(function(r){if(e=document.getElementsByTagName(r),n=e.length,n>1)for(var o=0;n>o;o++)a(e[o],t[r])})}function c(e,n){for(var t=0,r=e.length;r>t;t++)for(var a=e[t].getElementsByTagName("a"),u=0,c=a.length;c>u;u++)a[u].addEventListener("click",function(){o(n,"hidden")})}function i(e,n){for(var t=0,r=e.length;r>t;t++)e[t].addEventListener("click",function(){o(n,"hidden")})}function d(){var e=document.createElement("li");return a(e,"pure-menu-item"),e}function l(e){var n=document.createElement("a");return n.id="menu-"+e,n.href="#",n.innerHTML=t(e),a(n,"pure-menu-link"),n}function m(e){var n=document.createDocumentFragment(),t=document.createElement("nav"),r=document.createElement("div"),o=document.createElement("ul");n.appendChild(t),t.appendChild(r),r.appendChild(o),a(r,"pure-menu"),a(o,"pure-menu-list");var u="All sections",c=d();a(c,"pure-menu-selected"),o.appendChild(c),c.appendChild(l(u));for(var i,m,s=0,f=e.length;f>s;s++)i=e[s].getAttribute("id"),m=d(),o.appendChild(m),m.appendChild(l(i));var p=document.getElementById("page-content");document.querySelector("body").insertBefore(n,p)}function s(e){var n;e.hasAttribute("pure-menu-selected")||(n=document.querySelector(".pure-menu-selected"),o(n,"pure-menu-selected"),a(e,"pure-menu-selected"))}function f(e,n){var t,u=n.getAttribute("id"),c=u.replace(/menu-/,""),i=document.getElementById(u).parentNode;s(i);for(var d in e)t=e[d],r(t,"hidden")||a(t,"hidden"),t.getAttribute("id")===c&&r(t,"hidden")&&o(t,"hidden")}function p(e){var n;for(var t in e)n=e[t],r(n,"hidden")&&o(n,"hidden")}function v(e){for(var n=document.querySelectorAll(".pure-menu-link"),t=0,r=n.length;r>t;t++)0===t?n[t].addEventListener("click",function(){p(e)}):n[t].addEventListener("click",function(){f(e,this)})}return{main:function(){if(u(),document.getElementsByClassName("level2").length>0){var e,n=[];["abstract","level2","footnotes"].forEach(function(t){e=document.getElementsByClassName(t);for(var r=0,a=e.length;a>r;r++)n.push(e[r])});var t;for(var o in n)t=n[o],r(t,"level2")||a(t,"level2"),r(t,"footnotes")&&t.setAttribute("id","footnotes");m(n),v(n);var d=document.getElementsByClassName("citation"),l=document.getElementById("references");c(d,l);var s=document.getElementsByClassName("footnoteRef"),f=document.getElementById("footnotes");i(s,f)}}}}();window.addEventListener("load",function(){mindoc.main()});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<!-- For debugging local scripts -->
|
||||||
|
<!-- <script src="../build/mindoc.js"></script> -->
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user