-
Notifications
You must be signed in to change notification settings - Fork 0
/
AES.tex
435 lines (318 loc) · 13.1 KB
/
AES.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
% ---------------------------------- AES ---------------------------------------
\documentclass[a4paper,12pt]{book}
% ----------------------------- BEGIN PREAMBLE ---------------------------------------
\usepackage{lmodern}
\usepackage{alltt, fancyvrb, url}
%\usepackage{float}
\usepackage[rawfloats=true]{floatrow}
\restylefloat{figure} % questo forse riduce gli spazi bianchi tra immagini e testo.
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage[compact]{titlesec} %porre titlesec prima di hyperref per evitare il warning "The anchor of a bookmark and its parent's must not(hyperref) be the same".
% ------- begin index ----------
% Questo va prima di hyperref, altrimenti non è cliccabile.
\usepackage{imakeidx}
\makeindex[columns=3, title=Indice Analitico, options= -s index.ist, intoc]
\usepackage[initsep = 15pt]{idxlayout}
% ------- end index ------------
\usepackage[breaklinks]{hyperref} %porre hyperref infondo al preamble perché altrimenti potrebbe dare warning tipo: "The anchor of a bookmark and its parent's must not(hyperref) be the same" dovuto al fatto che titlesec si trova dopo hyperref.
\usepackage{amsmath,amssymb,amsthm}
\usepackage{geometry} % [showframe] % serve per mostrare il margine, è da rimuovere quando ho finito di controllare il margine. %TODO: remove showframe %TODO: sistemare margini se uso geometry.
\usepackage[italian]{babel}
\usepackage[italian]{cleveref}
\usepackage{comment}
\usepackage[nopatch={eqnum,footnote}]{microtype} %[nopatch={eqnum,footnote}] aggiunto per evitare il warning "patching footnotes failed"
\usepackage{fancyhdr}
\usepackage[scaled=.92]{helvet}
\usepackage[T1]{fontenc}
\usepackage{lscape}
\usepackage{subcaption}
\usepackage{enumerate}
%\usepackage{enumitem} %per enumerate con roman labels.
% ------ title -------------------
\usepackage[svgnames]{xcolor}
\ifpdf
\usepackage{pdfcolmk}
\fi
%% check if using xelatex rather than pdflatex
\ifxetex
\usepackage{fontspec}
\fi
%% drawing package
\usepackage{tikz}
%% for dingbats
\usepackage{pifont}
\providecommand{\HUGE}{\Huge}% if not using memoir
\newlength{\drop}
% ------ end title -------------------
% ------ chapter style -----------
\usepackage{kpfonts}
\usepackage{xcolor,calc, blindtext}
\definecolor{chaptercolor}{gray}{0.8}
% ------ end chapter style -----------
% ----- font family ------------------
%\usepackage{tgbonum}
%\fontfamily{cmss}\selectfont
\fontencoding{T1}
\fontfamily{garamond}
\fontseries{m}
%\fontshape{it}
%\fontsize{12}{15}
\selectfont %da warning forse perché viene usato \bfseries\scshape
%\usepackage{utopia} %utopia è obsoleto; usare fourier al posto.
% ----- end font family ------------------
% ------ section ---------
% ------ end section ---------
\usepackage{longtable}
% ---- ornamenti (distaccamenti) ---------
% per gli ornamenti, servono per distaccare parti del testo.
\usepackage{fourier-orns}
\newcommand{\fleuron}{
\par\nopagebreak
\parbox{\linewidth}{
\centering\bigskip\aldineleft\par\bigskip
}
}
\newcommand{\ornament}{
\par\nopagebreak
\parbox{\linewidth}{
\centering\bigskip$\ast$\par$\ast\quad\ast$\par\bigskip
}
}
% ---- ornamenti (distaccamenti) end ---------
% ----- firma (signature) begin ----------------
%\usepackage{emerald} %questo non lo trova
\usepackage{frcursive}
\usepackage{inslrmin}
\usepackage{soul} % per la sottolineatura.
\usepackage{setspace} % prima aveva anche l'option [doublespacing], ma dava errore.
% ----- firma (signature) end ----------------
% ----- per molteplici colonne begin ----------------
\usepackage{multicol}
% ----- per molteplici colonne end ----------------
% ----- empty page command begin -------------
\newcommand\blankpage{% comando pagina vuota
\clearpage
\begingroup
\null
\thispagestyle{empty}%
\addtocounter{page}{-1}%
\hypersetup{pageanchor=false}%
\clearpage
\endgroup
}
% ----- empty page command end -------------
% ----- code ----------------
\usepackage{listingsutf8}
\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}
\definecolor{myblue}{rgb}{0.3, 0.6, 0.8}
\definecolor{myblue2}{rgb}{0.11, 0.19, 0.46}
\definecolor{myblue3}{rgb}{0.27, 0.55, 0.81}
% VS2017 C++ color scheme
\definecolor{clr-background}{RGB}{255,255,255}
\definecolor{clr-text}{RGB}{0,0,0}
\definecolor{clr-string}{RGB}{163,21,21}
\definecolor{clr-namespace}{RGB}{0,0,0}
\definecolor{clr-preprocessor}{RGB}{128,128,128}
\definecolor{clr-keyword}{RGB}{0,0,255}
\definecolor{clr-type}{RGB}{43,145,175}
\definecolor{clr-variable}{RGB}{0,0,0}
\definecolor{clr-constant}{RGB}{111,0,138} % macro color
\definecolor{clr-comment}{RGB}{0,128,0}
\definecolor{weborange}{RGB}{255,165,0}
\lstdefinestyle{VS2017}{
backgroundcolor=\color{clr-background}, % oppure darkgray o darkgrey %TODO: mettere quello classico.
basicstyle=\color{clr-text}, % any text
stringstyle=\color{clr-string},
identifierstyle=\color{clr-variable}, % just about anything that isn't a directive, comment, string or known type
commentstyle=\color{clr-comment},
directivestyle=\color{clr-preprocessor}, % preprocessor commands
% listings doesn't differentiate between types and keywords (e.g. int vs return)
% use the user types color
keywordstyle=\color{clr-type},
keywordstyle={[2]\color{clr-constant}}, % you'll need to define these or use a custom language
breaklines=true,
showspaces=false,
showstringspaces=false,
%otherkeywords={>,<,.,;,-,!,=,~},
morekeywords={\#, std, std::cout, cout, std::endl, endl, ::, ifndef, define, endif, pragma, override, decltype, noexcept, alignas, alignof, constexpr, assert, nullptr}, % \# non funziona.
%keywordstyle=\color{weborange},
tabsize=4
}
\lstdefinestyle{mystyle}{
backgroundcolor=\color{backcolour},
commentstyle=\color{codegreen},
keywordstyle=\color{myblue2}, % prima era magenta
numberstyle=\tiny\color{codegray},
stringstyle=\color{codepurple},
basicstyle=\ttfamily\footnotesize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
keepspaces=true,
numbers=left,
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2
%classoffset=1, % starting new class
%otherkeywords={>,<,.,;,-,!,=,~},
%morekeywords={>,<,.,;,-,!,=,~},
%keywordstyle=\color{red},
%classoffset=0,
}
%\lstset{inputencoding=utf8/latin1} % Questo non andava.
\lstset{language=C++,texcl=true} % questo mi ha fixato il problema delle lettere
% accentate nei commenti, ma non nelle stringhe " " del codice.
% Altrimenti sempre per il problema delle lettere accentat, si può usare questo:
% Anzi questo mi aiuta per le stringhe nel codice " ".
%\begin{comment}
\lstset{
literate=%
{á}{{\'a}}1
{à}{{\`a}}1
{ã}{{\~a}}1
{é}{{\'e}}1
{è}{{\`e}}1
{ê}{{\^e}}1
{í}{{\'i}}1
{ó}{{\'o}}1
{õ}{{\~o}}1
{ú}{{\'u}}1
{ü}{{\"u}}1
{ù}{{\`u}}1
{ç}{{\c{c}}}1
{¡}{{\'!}}1
}
%\end{comment}
\lstset{style=VS2017}
%frame (ovvero un box) attorno al codice
\begin{comment}
\usepackage[most]{tcolorbox}
\usepackage{inconsolata}
\newtcblisting[auto counter]{listingframe}[2][]{sharp corners,
fonttitle=\bfseries, colframe=gray, listing only,
listing options={basicstyle=\ttfamily,language=java},
title=Listing \thetcbcounter: #2, #1}
\end{comment}
% ------ end code -----------
% hyperref settings
\hypersetup{
colorlinks=true,
linkcolor=black, %blue
filecolor=magenta,
urlcolor=cyan,
pdftitle={Sharelatex Example},
bookmarks=true, %commentato per via del warning
pdfpagemode=FullScreen,
}
% ----------------------------- END PREAMBLE -----------------------------------------
% ----------------------------- BEGIN BIBLIOGRAPHY ----------------------------------
\bibliographystyle{unsrt} % prima era plain
% ----------------------------- END BIBLIOGRAPHY ------------------------------------
% ----------------------------- BEGIN CHAPTER STYLE ----------------------------------
% ================== Chapter Style 1 ================================================
%\definecolor{gray75}{gray}{0.75}
%\newcommand{\hsp}{\hspace{20pt}}
%\titleformat{\chapter}[hang]{\Huge\bfseries}{\thechapter\hsp\textcolor{gray75}{|}\hsp}{0pt}{\Huge\bfseries}
% ================== Chapter Style 2 ================================================
%Options: Sonny, Lenny, Glenn, Conny, Rejne, Bjarne, Bjornstrup
\usepackage[Lenny]{fncychap}
% ----------------------------- END CHAPTER STYLE ------------------------------------
% ----------------------------- BEGIN SPACING ----------------------------------------
%\usepackage[compact]{titlesec} % you need this package
\titlespacing{\section}{0pt}{0pt}{0pt} % this reduces space between (sub)sections to 0pt, for example
\AtBeginDocument{% % this will reduce spaces between parts (above and below) of texts within a (sub)section to 0pt, for example - like between an 'eqnarray' and text
\setlength\abovedisplayskip{0pt}
\setlength\belowdisplayskip{0pt}}
\begin{comment}
\titlespacing{\subsection}{0pt}{0pt}{0pt} % this reduces space between (sub)sections to 0pt, for example
\AtBeginDocument{% % this will reduce spaces between parts (above and below) of texts within a (sub)section to 0pt, for example - like between an 'eqnarray' and text
\setlength\abovedisplayskip{0pt}
\setlength\belowdisplayskip{0pt}}
\end{comment}
% ----------------------------- END SPACING ------------------------------------------
% ----------------------------- BEGIN SECTION STYLE ----------------------------------
\titleformat
{\section} % command
[display] % shape
{\bfseries\Large\itshape} % format
{} % label
{0.5ex} % sep
{
\vspace{1ex} % prima era 1ex
\rule{\textwidth}{2pt} % 2pt
\centering
} % before-code
[
\vspace{-2ex}% 2ex
\rule{\textwidth}{1.5pt} % prima era 1.5 col font classico.
] % after-code
% ----------------------------- END SECTION STYLE ------------------------------------
% ----------------------------- BEGIN SUBSECTION STYLE -------------------------------
\titleformat{\subsection}{\centering\bfseries\Large\itshape}{}{}{}
% ----------------------------- END SUBSECTION STYLE ---------------------------------
% ----------------------------- BEGIN SUBSUBSECTION STYLE ----------------------------
\titleformat{\subsubsection}{\centering\bfseries\large\itshape}{}{}{}
% ----------------------------- END SUBSUBSECTION STYLE ------------------------------
% ----------------------------- BEGIN PARAGRAPH STYLE --------------------------------
\titleformat{\paragraph}{\centering\bfseries\normalsize}{}{}{}
% ----------------------------- END PARAGRAPH STYLE ----------------------------------
% ----------------------------- BEGIN TABLE OF CONTENTS ------------------------------
\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{1}
% ----------------------------- END TABLE OF CONTENTS --------------------------------
%\usepackage{enumitem}
%\setlist[description]{style=nextline}
%\leavevmode
\newcommand*{\titleRF}{\begingroup% Robert Frost, T&H p 149
%\FSfont{5bp} % FontSite Bergamo (Bembo)
%49
\drop = 0.2\textheight
\centering
\vfill
{\Huge Advanced Encryption Standard}\\[\baselineskip]
{\Huge AES}\\[\baselineskip]
{\large Luca Rengo}\\[0.5\drop]
{\Large }%\\[0.5\baselineskip] %TODO: \plogo da problemi; questo \\ dava l'errore: "there is no line to end here"
{\large v1.0.0}\\
{\Large \scshape Maggio | Aprile}\par
{\large \scshape \hspace{2mm} 2022 | 2023}\\
{\includegraphics[width=0.6\textwidth, height=0.6\textheight, keepaspectratio]{./images/aes/500px-AES_(Rijndael)_Round_Function.png}}
\vfill\null
\endgroup}
% ----------------------------- END TITLE PAGE ---------------------------------------
% ----------------------------- END ABSTRACT -----------------------------------------
\newenvironment{abstract}{}{}
\usepackage{abstract}
% ----------------------------- END ABSTRACT -----------------------------------------
% ----------------------------- BEGIN DOCUMENT ---------------------------------------
\begin{document}
\frontmatter
\titleRF
\thispagestyle{empty} % serve per rimuovere il numero della pagina dal titolo.
\tableofcontents
% \input: import the commands from filename.tex to target file.
% \include: does a \clearpage and does an \input.
% \import: needs \usepackage{import} and it's used only when the imported files needs the path. \import{path}{filename}
\mainmatter
\include{Abstract}
\include{Storia_di_AES}
\include{Algoritmo}
\include{La_matematica_dietro_AES}
\include{Le_modalità_di_AES}
\include{Implementazione}
\include{Attacchi_e_Sicurezza_su_AES}
\include{Conclusioni}
%TODO: Prima dell'implementazione facciamo: "Le modalità di AES" oppure anche prima del capitolo "La matematica dietro AES" oppure anche no!
%TODO: Implementazione %TODO: oppure dipende dall'implementazione, se nell'implementazione c'è solo AES, allora la parte delle Modalità la metto dopo, altrimenti prima.
\backmatter
\printindex
\nocite{*} % Questo serve per mostrare tutta la bibliografia, anche se non la si è citata.
\bibliography{bibliography.bib}
\end{document}
% ----------------------------- END DOCUMENT -----------------------------------------