Created
February 6, 2025 12:07
-
-
Save gszr/534827be5ab805b5424410de8a813751 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass{article} | |
\usepackage{amsmath} | |
\usepackage{algorithm} | |
\usepackage{algpseudocode} | |
\begin{document} | |
\noindent | |
\begin{minipage}{0.45\linewidth} | |
\raggedright | |
\textbf{\(\mathcal{S_E}_K(M)\)} \\[5pt] | |
\begin{algorithmic}[1] | |
\State \textbf{Break} \( M \) into \( n \)-bit blocks: | |
\State \( M_1 \parallel \dots \parallel M_p \) | |
\State \( IV \gets \${0,1}^n \) | |
\State \( C_0 \gets IV \) | |
\State \( C_1 \gets E(K, IV) \) | |
\For{\( i = 1 \) to \( p \)} | |
\State \( C_{i+1} \gets E(K, C_i \oplus M_i) \) | |
\EndFor | |
\State \textbf{Return} \( C_0 \parallel C_1 \parallel \dots \parallel C_{p+1} \) | |
\end{algorithmic} | |
\end{minipage} | |
\hfill\vline\hfill | |
\begin{minipage}{0.45\linewidth} | |
\raggedright | |
\textbf{\(\mathcal{S_D}_K(C)\)} \\[5pt] | |
\begin{algorithmic}[1] | |
\State \textbf{Break} \( C \) into \( n \)-bit blocks: | |
\State \( C_0 \parallel C_1 \parallel \dots \parallel C_{p+1} \) | |
\For{\( i = 1 \) to \( p \)} | |
\State \( M_i \gets E^{-1}(K, C_{i+1}) \oplus C_i \) | |
\EndFor | |
\State \( M \gets M_1 \parallel \dots \parallel M_p \) | |
\State \( IV \gets E^{-1}(K, C_1) \) | |
\If{\( IV \neq C_0 \)} | |
\State \textbf{Return} \( \perp \) | |
\Else | |
\State \textbf{Return} \( M \) | |
\EndIf | |
\end{algorithmic} | |
\end{minipage} | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment