![在 Tikz 中创建加密盒安全游戏](https://linux22.com/image/381721/%E5%9C%A8%20Tikz%20%E4%B8%AD%E5%88%9B%E5%BB%BA%E5%8A%A0%E5%AF%86%E7%9B%92%E5%AE%89%E5%85%A8%E6%B8%B8%E6%88%8F.png)
答案1
简单回答一下:
\documentclass[border=5pt,tikz]{standalone}
\usepackage{yfonts,amsmath,amssymb,amsfonts}
\usetikzlibrary{arrows,positioning,calc}
\begin{document}
\begin{tikzpicture}[>=latex]
\node[draw,inner sep=1.5cm] (a) {$A$};
\node at (-7,0) (pk) {\textfrak{pk}};
\draw[->] (pk) -- (a);
\node[below=.2 of pk] (ms) {$m^*,s^*$};
\draw[<-] (ms) --+ (5.35,0) node[midway,align=center,below,text width=4cm] {Win if \textsf{\textcolor{blue}{Verify$_{\textfrak{pk}}$}$(s^*,m^*)=\mathtt{valid}$ and $m^*\not\in\textcolor{red}{\mathcal{L}}$}};
\node (n) at ([yshift=-.5cm,xshift=.5cm]a) {$m\in\mathbb{P}$};
\draw[->] ($(n)+(1.15,0)$) --+ (2.8,0) node[midway,above] {$\mathcal{O}_{\textsf{Sig}_{\mathfrak{s\!k}}}$};
\node[right] at ($(n)+(3.85,0)$) {$\textcolor{red}{\mathcal{L}}\leftarrow\textcolor{red}{\mathcal{L}}\cup\{m\}$};
\draw[->] (4.4,-1) --+ (-2.75,0);
\node[yshift=-.5cm,right] at ($(n)+(3.85,0)$) {$t\leftarrow\textcolor{red}{\textsf{Sig}_{\textcolor{blue}{\mathfrak{sk}}}}(m)$};
\node[xshift=1.5cm,above=.5 of pk] {$(\textcolor{blue}{\mathfrak{pk}},\textcolor{red}{\mathfrak{sk}})\leftarrow\mathrm{KeyGen()}$};
\node[xshift=11cm,above=.5 of pk] {$\textcolor{red}{\mathcal{L}}\leftarrow\emptyset$};
\end{tikzpicture}
\end{document}
输出如下: