% \begin{meta-comment}
%
-% $Id: crypto.dtx,v 1.1 2002/02/03 20:49:03 mdw Exp $
+% $Id: crypto.dtx,v 1.2 2003/09/05 16:13:14 mdw Exp $
%
% Typesetting crypto papers
%
% (c) 2001 Mark Wooding
%
-%----- Revision history -----------------------------------------------------
-%
-% $Log: crypto.dtx,v $
-% Revision 1.1 2002/02/03 20:49:03 mdw
-% Checkin for new build system.
-%
-%
% \end{meta-comment}
%
% \begin{meta-comment} <general public licence>
%% it under the terms of the GNU General Public License as published by
%% the Free Software Foundation; either version 2 of the License, or
%% (at your option) any later version.
-%%
+%%
%% This program is distributed in the hope that it will be useful,
%% but WITHOUT ANY WARRANTY; without even the implied warranty of
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
%% GNU General Public License for more details.
-%%
+%%
%% You should have received a copy of the GNU General Public License
%% along with this program; if not, write to the Free Software Foundation,
%% Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
%<+package> [2001/09/16 1.0 Crypto typesetting]
% \end{meta-comment}
%
-% \CheckSum{215}
+% \CheckSum{258}
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
% table~\ref{tab:kw}. The typsetting of these is done by the |\kw| command,
% which usually sets its argument in text bold face, but can be redefined.
% The standard definition uses |\xspace| so that you don't need to remember
-% to say \verb*+\ *+ after a keyword command.
+% to say \verb*+\ + after a keyword command.
% \begin{table}
% \centering
% \def\row#1{\texttt{\string#1} & #1 \\}
% \row\TO
% \row\ABORT
% \row\PARSE
+% \row\NEW
% \row\AS
% \end{tabular}
% \caption{Keywords available for algorithm typesetting}
% \label{tab:kw}
% \end{table}
%
+% \DescribeMacro\ind
+% Within a \env{program} environment, the |\ind| command shunts the indent
+% level 1\,em to the right.
+%
% \DescribeMacro\gets
% \DescribeMacro\getsr
% \DescribeMacro\inr
% using the |\inr| command, which just typesets an $\in$ sign with a
% subscript `R': `$\inr$'.
%
+% Should one wish, one can use a different character than `R' to denote
+% randomness. Some authors use `\$', for example. I know of one
+% (cheapskate?) author who has used `\rlap/c'. Redefining the |\random|
+% command lets you do this. For example, you can say
+% |\newcommand{\random}{\$}| should you so wish.
+%
% \DescribeMacro\id
% Long identifiers can be typeset using the |\id| command. giving the
% identifier name as an argument. The |\id| command is only valid in maths
% \DescribeMacro\Adv
% \DescribeMacro\InSec
% \DescribeMacro\Expt
+% \DescribeMacro\Game
% \begin{synshorts}
% Some standard `things' are provided: "\\Succ{"<notion>"}{"<scheme>"}",
-% "\\Adv{"<notion>"}{"<scheme>"}", "\\InSec{"<notion>"}", and
-% "\\Expt{"<notion>"}{"<scheme>"}".
+% "\\Adv{"<notion>"}{"<scheme>"}", "\\InSec{"<notion>"}",
+% "\\Expt{"<notion>"}{"<scheme>"}", and "\\Game{"<notion>"}{"<scheme>"}".
% \end{synshorts}
%
% \DescribeMacro\G
% \syntax{"\\Perm{"<L>"}"} typeset $\Func{l}{L}$ and $\Perm{L}$ respectively,
% and are intended to denote the sets of all functions $F\colon \{0, 1\}^l
% \to \{0, 1\}^L$ and all permutations $\Pi\colon \{0, 1\}^L \to \{0, 1\}^L$
-% respectively.
+% respectively.
%
% \DescribeMacro\PKCS
% Finally, the |\PKCS| macro typesets `\PKCS{$n$}', allowing you to name RSA
% Security Inc.'s Public Key Cryptography Standards in a relatively nice way.
-%
+%
% \implementation
%
%
\RequirePackage{amstext}
\RequirePackage{xspace}
% \end{macrocode}
-
+%
% \subsection{Algorithm typsetting}
%
% \begin{macro}{\cookie}
% nicer.
%
% \begin{macrocode}
-\def\inr{\mathrel{\in_R}}
-\def\getsr{\mathrel{\mathop{\gets}\limits^{\scriptscriptstyle R}}}
+\providecommand\random{R}
+\def\inr{\mathrel{\in_{\random}}}
+\def\getsr{\mathrel{\mathop{\gets}\limits^{\scriptscriptstyle\random}}}
% \end{macrocode}
%
% \end{macro}
\def\FOREACH{\kw{for\,each}}
\def\FROM{\kw{from}}
\def\IN{\kw{in}}
-\def\TO{\kw{in}}
+\def\TO{\kw{to}}
\def\ABORT{\kw{abort}}
\def\PARSE{\kw{parse}}
\def\AS{\kw{as}}
+\def\NEW{\ifmmode\mathop{\kw{new}}\else\kw{new}\fi}
+\def\SEND{\kw{send}}
+\def\OUTPUT{\kw{output}}
+\def\STOP{\kw{stop}}
% \end{macrocode}
%
% \begin{environment}{program}
% \begin{macro}{\next}
% \begin{macro}{\newline}
+% \begin{macro}{\ind}
%
% Now for the \env{program} environment and its associated twiddling. This
% is actually a little fiddly.
\@tempswatrue\ifvmode\@tempswafalse\fi%
\def\next{\program@end\vrule\program@begin}%
\def\newline{\program@endline\medskip\program@startline}%
+ \def\ind{\quad\=\+\kill}%
+ \ifdim\topsep<\parskip\topsep\parskip\fi%
+ \ifdim\@topsepadd<\z@\@topsepadd\z@\fi%
\begingroup\trivlist%
\advance\@topsep-\parskip\advance\@topsepadd-\parskip\item%
\program@startline%
% \begin{macrocode}
\def\endprogram{%
\program@endline\endtrivlist\endgroup%
- \if@tempswa\noindent\fi\@ignoretrue%
+ \if@tempswa\@endparenv\fi\@ignoretrue%
}
% \end{macrocode}
%
\setbox\z@\lastbox\unskip\unskip\unskip\setbox\z@\lastbox\unskip%
\endgroup%
\prevdepth-\@m\p@%
- \@startfield\strut%
+ \@startfield\strut\ignorespaces%
}
% \end{macrocode}
%
%
% \end{macro}
% \end{macro}
+% \end{macro}
% \end{environment}
%
% \subsection{Other stuff}
% \begin{macro}{\Adv}
% \begin{macro}{\InSec}
% \begin{macro}{\Expt}
+% \begin{macro}{\Game}
%
% Typesetting |\Thing| is easy. This acts as a style hook for the rest of
-% these things..
+% these things.
%
% \begin{macrocode}
\def\Thing#1#2#3{\text{\normalfont\bfseries#1}^{\text{\normalfont#2}}_{#3}}
\def\Adv{\Thing{Adv}}
\def\InSec#1{\Thing{InSec}{#1}{}}
\def\Expt{\Thing{Expt}}
+\def\Game{\Thing{Game}}
% \end{macrocode}
%
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
%
% \begin{macro}{\G}
%