From ece696adddc211bb93386fdca9c15dd829b9ce6e Mon Sep 17 00:00:00 2001 From: "flyingscorpio@clevo" Date: Tue, 15 Feb 2022 12:46:09 +0100 Subject: [PATCH] Start RSA with bezout --- algebre-non-lineaire/main.tex | 51 +++++++++++++++--- algebre-non-lineaire/styles.sty | 94 +++++++++++++++++++++++++++++++++ 2 files changed, 139 insertions(+), 6 deletions(-) create mode 100644 algebre-non-lineaire/styles.sty diff --git a/algebre-non-lineaire/main.tex b/algebre-non-lineaire/main.tex index 50a468d..722ca2e 100644 --- a/algebre-non-lineaire/main.tex +++ b/algebre-non-lineaire/main.tex @@ -4,7 +4,7 @@ \author{} \date{Dernière compilation~: \today{} à \currenttime} -\usepackage{../cours} +\usepackage{styles} \usepackage{tikz} \usetikzlibrary{shapes.multipart} \DeclareMathOperator\pgcd{pgcd} @@ -704,11 +704,9 @@ On ne peut donc pas choisir $e$ et $d$ au hasard. $e$ et $d$ sont liés. - \subsection{Indicatrice d'Euler} + \subsection{$\varphi(n)$~: Indicatrice d'Euler} Dans $\frac{\mathbb{Z}}{n\mathbb{Z}}$~: - - \begin{center} \begin{tabular}{cc|cccccrc} \multicolumn{2}{c}{$n=7$} & \multicolumn{7}{c}{puissances} \\ \toprule @@ -723,7 +721,6 @@ $\overline{6}$ & oui & $\overline{6}$ & $\overline{1}$ & $\overline{6}$ & $\overline{1}$ & $\overline{6}$ & $\overline{1}$ & $\overline{6}$ \\ \bottomrule \end{tabular} - \end{center} \begin{itemize} \item 6 éléments inversibles @@ -766,7 +763,6 @@ \end{align*} Ceci implique que, par exemple~: - \begin{align*} \text{Dans } \frac{\mathbb{Z}}{200\mathbb{Z}}\;: \varphi(200) = 80 \implies 80 \text{ éléments inversibles} \\ \overline{37} \text{ est inversible} \\ @@ -782,4 +778,47 @@ \eqref{eq:rsa} est le théorême fondamental de RSA\@. + \subsection{$\varphi(n)$ appliqué à l'identité de Bezout} + + Le fonctionnement de RSA se base sur $\varphi(n)$ appliqué à l'identité de Bezout. + + Pour rappel~: + \begin{equation*} + \forall \; (a,b) \in \mathbb{N}^2 : \exists\, (u,v) \in \mathbb{Z}^2 \; / \; a \times u + b \times v = \pgcd(a,b) + \end{equation*} + + Soit $n=p \times q$ \quad on a $\varphi(n)$ \quad on choisit $e \; / \pgcd(e, \varphi(n)) = 1$ + + En appliquant Bezout à $e$ et $\varphi(n)$~: + \begin{equation*} + \exists\, (d,k) \; / \; e \cdot d + k \cdot \varphi(n) = 1 + \end{equation*} + \begin{align*} + \text{Soit } a \in [1,n-1] \quad + &a^{(ed + k\varphi(n))} = a^1 \\ + \iff & a^{ed} \times a^{k\varphi(n)} = a \\ + \iff & a^{ed} \times (a^{\varphi(n)})^k = a \\ + \iff & a^{ed}[n] \times (a^{\varphi(n)}[n])^k = a + \quad\text{ or d'après RSA~: } a^{\varphi(n)}[n] = 1 \\ + \text{donc } & a^{ed}[n] \times 1^k = a \\ + \iff & a^{ed}[n] = a + \end{align*} + \begin{equation*} + \text{alors } \exists\, d\; /\; \forall\; a \in [1,n-1] \quad a^{ed}[n] = a + \end{equation*} + \hfill + où $d$ est le coefficient de Bezout associé à $e$. + + \begin{center} + \begin{tikzpicture} + \node (a1) at (0,0) {$a$}; + \node (chiff) at (2,0) {$a^e[n]$}; + \draw [-latex] (a1) -- (chiff); + \node (dechiff) at (6,0) {$(a^e[n])^d[n] = a^{ed}[n]$}; + \draw [-latex] (chiff) -- (dechiff); + \node (a2) at (10,0) {$a$}; + \draw [-latex] (dechiff) -- (a2); + \end{tikzpicture} + \end{center} + \end{document} diff --git a/algebre-non-lineaire/styles.sty b/algebre-non-lineaire/styles.sty new file mode 100644 index 0000000..f037c8d --- /dev/null +++ b/algebre-non-lineaire/styles.sty @@ -0,0 +1,94 @@ +\ProvidesPackage{styles} + +\usepackage[ + %showframe, + a4paper,includeheadfoot,margin=2cm,top=1cm,bottom=1cm +]{geometry} + +\setcounter{tocdepth}{2} + +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{babel} + +\usepackage{datetime} + +\usepackage{color} + +\usepackage{amsmath} +\usepackage{amsfonts} +\everymath{\displaystyle} +\newcommand*\dif{\mathop{}\!\mathrm{d}} + +\usepackage{booktabs} +\usepackage{tabularx} +\newcolumntype{Y}{>{\centering\arraybackslash}X} +\usepackage{multicol} +\usepackage{multirow} +\usepackage{makecell} +\usepackage{parskip} +\usepackage{microtype} + +\usepackage{listingsutf8} +\lstset{% + inputencoding=utf8/latin1, + basicstyle=\small\ttfamily, + columns=flexible, + breaklines=true, + extendedchars=true, + 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 + {Ã}{{\~A}}1 {ã}{{\~a}}1 {Õ}{{\~O}}1 {õ}{{\~o}}1 {œ}{{\oe}}1 + {Œ}{{\OE}}1 {æ}{{\ae}}1 {Æ}{{\AE}}1 {ß}{{\ss}}1 {ű}{{\H{u}}}1 + {Ű}{{\H{U}}}1 {ő}{{\H{o}}}1 {Ő}{{\H{O}}}1 {ç}{{\c c}}1 + {Ç}{{\c C}}1 {ø}{{\o}}1 {å}{{\r a}}1 {Å}{{\r A}}1 + {€}{{\euro}}1 {£}{{\pounds}}1 {«}{{\guillemotleft}}1 + {»}{{\guillemotright}}1 {ñ}{{\~n}}1 {Ñ}{{\~N}}1 {¿}{{?`}}1 +} +\let\oldlstinputlisting\lstinputlisting +% make \lstinputlisting always have frame +\renewcommand{\lstinputlisting}[2][]{\oldlstinputlisting[frame=single,#1]{#2}} + +\lstnewenvironment{console}[1][]{% + \lstset{% + inputencoding=utf8/latin1, + basicstyle=\small\ttfamily\color{white}, + columns=flexible, + breaklines=true, + extendedchars=true, + 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 + {Ã}{{\~A}}1 {ã}{{\~a}}1 {Õ}{{\~O}}1 {õ}{{\~o}}1 {œ}{{\oe}}1 + {Œ}{{\OE}}1 {æ}{{\ae}}1 {Æ}{{\AE}}1 {ß}{{\ss}}1 {ű}{{\H{u}}}1 + {Ű}{{\H{U}}}1 {ő}{{\H{o}}}1 {Ő}{{\H{O}}}1 {ç}{{\c c}}1 + {Ç}{{\c C}}1 {ø}{{\o}}1 {å}{{\r a}}1 {Å}{{\r A}}1 + {€}{{\euro}}1 {£}{{\pounds}}1 {«}{{\guillemotleft}}1 + {»}{{\guillemotright}}1 {ñ}{{\~n}}1 {Ñ}{{\~N}}1 {¿}{{?`}}1, + backgroundcolor=\color{black}, #1 + }% +}{} + +\usepackage{graphicx} + +\usepackage[hyphens]{url} +\usepackage[colorlinks,hidelinks]{hyperref} + +\usepackage{letltxmacro} +\LetLtxMacro{\normalparagraph}{\paragraph} +\renewcommand{\paragraph}[1]{\normalparagraph{#1}\mbox{}} + +\sloppy