This commit is contained in:
jude 2023-04-28 14:25:59 +01:00
parent 663b8ab4de
commit a7daf39918
2 changed files with 117 additions and 29 deletions

Binary file not shown.

View File

@ -28,6 +28,8 @@
\usepackage{hyperref}
\usepackage[alph]{parnotes}
\usetikzlibrary{decorations.pathreplacing,decorations.markings}
\DeclareMathOperator{\lcm}{lcm}
\DeclareMathOperator{\id}{id}
\DeclareMathOperator{\pr}{pr}
@ -305,9 +307,9 @@ Despite this approach being centralised, it does emulate a fully P2P environment
In particular, the final point allows for the use of purely JSON messages, which are readily parsed and processed by the client-side JavaScript.
The game is broken down into three main stages, each of which handles events in a different way. These are shown below. Boxes in blue are messages received from other players (or transmitted by ourselves). Boxes in green require networking to complete.
The game is broken down into three main stages, each of which handles events in a different way. These are shown below. Boxes in blue are messages received from other players (or transmitted by ourselves). Boxes in green require us to transmit a message to complete.
\begin{landscape}\begin{tikzpicture}[every node/.style={anchor=north west}]
\begin{landscape}\begin{tikzpicture}[every node/.style={anchor=north west,minimum height=20pt}]
% Create outlines
\node[
rectangle,
@ -396,14 +398,40 @@ The game is broken down into three main stages, each of which handles events in
\draw[very thick,->,dashed] (Act1)-- node[right] {Not all regions claimed} ++(Claim);
\draw[very thick,->,dashed] (Act1) -- (200pt, -67.5pt)-- node[right] {All regions claimed} ++(Reinf);
\node[draw=black!50,fill=white,rotate=270,rectangle,very thick,rounded corners=0.1mm,anchor=north] (Update2) at (0.5\paperwidth + 60pt, -155.5pt) {Update game stage};
\node[draw=black!50,fill=white,rotate=270,rectangle,very thick,rounded corners=0.1mm,anchor=north] (Update2) at (0.5\paperwidth + 60pt, -158pt) {Update game stage};
\draw[very thick,->,dashed] (End1)-- node[below] {All reinf. placed} ++(Update2);
% Player act handling 2
\node[draw=blue!50,rectangle,very thick,rounded corners=0.1mm,anchor=north] (Act2) at (0.5\paperwidth+120pt, 0.5\textheight-4pt) {Current player acts};
\node[draw=blue!50,rectangle,very thick,rounded corners=0.1mm,anchor=north] (Act2) at (0.5\paperwidth+112pt, 0.5\textheight-4pt) {Current player acts};
\node[draw=black!50,rectangle,very thick,rounded corners=0.1mm,anchor=north] (Reinf2) at (0.5\paperwidth+280pt, 140pt) {Reinforce regions};
\node[draw=black!50,rectangle,very thick,rounded corners=0.1mm,anchor=north] (Attack1) at (0.5\paperwidth+210pt, 70pt) {Attack region};
\node[draw=green!50,rectangle,very thick,rounded corners=0.1mm,anchor=north] (Attack2) at (0.5\paperwidth+210pt, 20pt) {Send defence};
\node[draw=blue!50,rectangle,very thick,rounded corners=0.1mm,anchor=north] (Attack3) at (0.5\paperwidth+340pt, 20pt) {Target defends};
\node[draw=green!50,rectangle,very thick,rounded corners=0.1mm,anchor=north] (Attack4) at (0.5\paperwidth+210pt, -30pt) {Resolve dice roll};
\draw[very thick,->,dashed] (Attack1) -- node[right] {Target region owned by us} ++ (Attack2);
\draw[very thick,->] (Attack2) -- (Attack4);
\draw[very thick,->] (Attack3) -- (0.5\paperwidth+340pt, -15pt) -- (0.5\paperwidth+210pt, -15pt) -- (Attack4);
\node[draw=black!50,rectangle,very thick,rounded corners=0.1mm,anchor=north] (Fortify) at (0.5\paperwidth+210pt, -90pt) {Fortify region};
\node[draw=black!50,rectangle,very thick,rounded corners=0.1mm,anchor=north] (End2) at (0.5\paperwidth+210pt, -140pt) {End turn};
\node[draw=black!50,rectangle,very thick,rounded corners=0.1mm,anchor=north] (End3) at (0.5\paperwidth+210pt, -190pt) {End game};
\draw[very thick,->,dashed] (End2) -- node[right] {All regions controlled by one player} ++(End3);
\draw[very thick,->] (Fortify) -- (End2);
\draw[very thick,->,dashed] (Act2) -- (0.5\paperwidth+112pt, 130pt) -- node[below] {Reinf. remaining} ++ (Reinf2);
\draw[very thick,->,dashed] (0.5\paperwidth+112pt, 130pt) -- (0.5\paperwidth+112pt, 60pt) -- (Attack1);
\draw[very thick,->,dashed] (0.5\paperwidth+112pt, 60pt) -- (0.5\paperwidth+112pt, -100pt) -- (Fortify);
\draw[very thick,->,dashed] (0.5\paperwidth+112pt, -100pt) -- (0.5\paperwidth+112pt, -150pt) -- (End2);
\end{tikzpicture}\end{landscape}
\section{Message structure}
@ -625,31 +653,33 @@ These points are referenced in the following sections.
The first proof to discuss is the honest-verifier protocol to prove knowledge that a ciphertext is an encryption of zero \cite[Section~5.2]{damgard2003}.
\begin{center}
\begin{tikzpicture}[every node/.append style={very thick,rounded corners=0.1mm}]
\node[draw,rectangle] (P) at (0,0) {Prover};
\node[draw,rectangle] (V) at (6,0) {Verifier};
\node[draw=blue!50,rectangle,thick,text width=5.05cm] (v) at (0,-1.5) {$r \in \mathbb{Z}_n^*$ with $c = r^n \mod n^2$};
\draw [->,very thick] (0,-3)--node [auto] {$c$}++(6,0);
\node[draw=blue!50,rectangle,thick] (r) at (0,-4) {Choose random $r^* \in \mathbb{Z}_n^*$};
\draw [->,very thick] (0,-5)--node [auto] {$a = (r^*)^n \mod n^2$}++(6,0);
\node[draw=blue!50,rectangle,thick] (e) at (6,-6) {Choose random $e$};
\draw [<-,very thick] (0,-7)--node [auto] {$e$}++(6,0);
\draw [->,very thick] (0,-8)--node [auto] {$z = r^*r^e \mod n$}++(6,0);
\node[draw=blue!50,rectangle,thick,text width=5cm] (verify) at (6,-9) {Verify $z, c, a$ coprime to $n$\\ Verify $z^n \equiv ac^e \mod n^2$};
\node[draw=none] (term) at (0,-9) {};
\fill (term) circle [radius=2pt];
\draw [very thick] (P)-- (v)-- (r)-- (0,-9);
\draw [very thick] (V)-- (e)-- (verify)-- (6,-9);
\end{tikzpicture}
\end{center}
\begin{protocol}[Proof of zero]\label{protocol0}
\begin{center}
\begin{tikzpicture}[every node/.append style={very thick,rounded corners=0.1mm}]
\node[draw,rectangle] (P) at (0,0) {Prover};
\node[draw,rectangle] (V) at (6,0) {Verifier};
\node[draw=blue!50,rectangle,thick,text width=5.05cm] (v) at (0,-1.5) {$r \in \mathbb{Z}_n^*$ with $c = r^n \mod n^2$};
\draw [->,very thick] (0,-3)--node [auto] {$c$}++(6,0);
\node[draw=blue!50,rectangle,thick] (r) at (0,-4) {Choose random $r^* \in \mathbb{Z}_n^*$};
\draw [->,very thick] (0,-5)--node [auto] {$a = (r^*)^n \mod n^2$}++(6,0);
\node[draw=blue!50,rectangle,thick] (e) at (6,-6) {Choose random $e$};
\draw [<-,very thick] (0,-7)--node [auto] {$e$}++(6,0);
\draw [->,very thick] (0,-8)--node [auto] {$z = r^*r^e \mod n$}++(6,0);
\node[draw=blue!50,rectangle,thick,text width=5cm] (verify) at (6,-9) {Verify $z, c, a$ coprime to $n$\\ Verify $z^n \equiv ac^e \mod n^2$};
\node[draw=none] (term) at (0,-9) {};
\fill (term) circle [radius=2pt];
\draw [very thick] (P)-- (v)-- (r)-- (0,-9);
\draw [very thick] (V)-- (e)-- (verify)-- (6,-9);
\end{tikzpicture}
\end{center}
\end{protocol}
A proof for the following homologous problem can be trivially constructed: given some ciphertext $c = g^mr^n \mod n^2$, prove that the text $cg^{-m} \mod n^2$ is an encryption of 0. The text $cg^{-m}$ is constructed by the verifier. The prover then proceeds with the proof as normal, since $cg^{-m}$ is an encryption of 0 under the same noise as the encryption of $m$ given.
@ -948,6 +978,64 @@ It is preferred that these proofs can be performed with only a few communication
We can apply the Fiat-Shamir heuristic to make proofs of zero non-interactive \cite{fiatshamir}. In place of a random oracle, we use a cryptographic hash function. We take the hash of some public parameters to prevent cheating by searching for some values that hash in a preferable manner. In this case, selecting $e = H(g, m, a)$ is a valid choice. To get a hash of desired length, an extendable output function such as SHAKE256 can be used \cite{FIPS202}. The library jsSHA \cite{jssha} provides an implementation of SHAKE256 that works within a browser.
\subsection{Application to domain}
\begin{figure}[H]
\centering
\begin{tikzpicture}[every node/.append style={
very thick,fill=white,
rounded corners=0.1mm,
minimum height=20pt}]
\node[draw,rectangle] (P1) at (0,-0.5) {Player 1};
\node[draw,rectangle] (V) at (6,-0.5) {World};
\node[draw,rectangle] (P2) at (12,-0.5) {Player 2};
\draw [very thick] (P1)-- (0,-15);
\draw [very thick] (V) -- (6,-15);
\draw [very thick] (P2)-- (12,-15);
\draw [->,very thick] (0,-3)--node [auto] {Protocol~\ref*{protocol1}}++(6,0);
\draw [->,very thick] (6,-3)--(12,-3);
\node[draw=blue!50,rectangle] at (0,-2) {Reinforce regions};
\draw [<->,very thick] (12,-4)-- node[above] {Protocol~\ref*{protocol0} (neighbouring counts)} ++ (-12,0);
\node[draw=blue!50,rectangle] at (0,-5) {Attack Player 2};
\draw [->,very thick] (0,-6)--node [auto] {Protocol~\ref*{protocol4}}++(6,0);
\draw [->,very thick] (6,-6)--++(6,0);
\node[draw=blue!50,rectangle] at (12,-7) {Send defence};
\draw [->,very thick] (12,-8)--node [above] {Protocol~\ref*{protocol4}}++(-6,0);
\draw [->,very thick] (6,-8)--++(-6,0);
\path (0,-9)-- node[above] {Protocol~\ref*{protocol2} (resolve dice)} ++ (12,0);
\draw [<->,very thick] (0,-9)--++ (6,0);
\draw [<->,very thick] (6,-9)--++ (6,0);
\path (0,-10)-- node[above] {Protocol~\ref*{protocol4} (prove maintained ownership)} ++ (12,0);
\draw [<->,very thick] (0,-10)--++ (6,0);
\draw [<->,very thick] (6,-10)--++ (6,0);
\node[draw=blue!50,rectangle] at (0,-11) {Fortify};
\draw [->,very thick] (0,-12)--node [auto] {Protocol~\ref*{protocol3}}++(6,0);
\draw [->,very thick] (6,-12)--(12,-12);
\draw [<->,very thick] (12,-13)-- node[above] {Protocol~\ref*{protocol0} (neighbouring counts)} ++ (-12,0);
\path (0,-14)--node [auto] {Protocol~\ref*{protocol4} (prove non-negative)}++(12,0);
\draw [->,very thick] (0,-14)--++(6,0);
\draw [->,very thick] (6,-14)--++(6,0);
\fill (0,-15) circle [radius=2pt] ;
\fill (6,-15) circle [radius=2pt] ;
\fill (12,-15) circle [radius=2pt] ;
\end{tikzpicture}
\caption{An example turn during the game incorporates each of the protocols presented above, some many times.}
\end{figure}
\chapter{Review}
\section{Theoretic considerations}