Initial commit

This commit is contained in:
Valentin Brandl
2018-10-13 13:23:37 +02:00
commit 1ad2f0e3ab
32 changed files with 2541 additions and 0 deletions

View 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{<EFBFBD>} &\text{:}& 18 \to{} 0.02 \\
sum &\text{:}& 1090
\end{eqnarray*}
\item
\begin{displayquote}
gr<67>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 & <20> \\
C & g \\
D & j \\
E & <20> \\
F & x \\
G & n \\
J & i \\
K & m \\
L & c \\
M & <20> \\
N & v \\
O & d \\
P & r \\
Q & a \\
R & l \\
S & e \\
T & <20> \\
U & h \\
V & z \\
W & t \\
X & w \\
Y & p \\
Z & s \\
<09> & o \\
<09> & b \\
<09> & u \\
<09> & 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{<EFBFBD>},\text{<EFBFBD>},\text{<EFBFBD>},\text{<EFBFBD>}\} \vert!$
\item Name des Textes: Major Tom (v<>llig losgel<65>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<68>ssel
\item $w$: Verl<72>ngerung der Schl<68>ssell<6C>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}

View 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

View 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 \\

View File

@ -0,0 +1,2 @@
/target
**/*.rs.bk

View 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"

View File

@ -0,0 +1,7 @@
[package]
name = "u01"
version = "0.1.0"
authors = ["Valentin Brandl <vbrandl@riseup.net>"]
[dependencies]
countmap = "0.2.0"

View 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);
}
}
}

Binary file not shown.