返回 Skill 列表
extension
分类: 开发与工程无需 API Key

writing-crypto

使用项目的bibsp.sty + preamble.tex约定(acro + biblatex脚注引用和标准化数学宏)来编写密码学散文和符号。在以下情况下主动使用:(1) 在.tex文件中编写/编辑密码学部分,(2) 引入或使用如IND-CPA、IND-CCA、AE、MAC、PRF、ZK和DH等密码学缩写,(3) 用数学符号定义方案/算法/变量,(4) 添加安全概念或标准原语的引用,(5) 编写安全性证明或归约,(6) 用户在密码学上下文中提到biblatex、密码学符号或安全性证明。

person作者: jakexiaohubgithub

Writing Crypto With bibsp

Overview

This project uses bibsp.sty (loaded from preamble.tex) to keep cryptography writing consistent: acronyms expand correctly and cite the right source, and common crypto notation is standardized via macro factories.

Quick Start

  1. Load the standard preamble (already done in the thesis):
\input{preamble}
  1. Use acronyms for crypto terms and security notions:
We model the adversary as \ac{PPT} and require \ac{IND-CPA} security.
We use \ac{DH} to establish a shared key and authenticate with a \ac{MAC}.
  1. Use \autocite{...} for non-acronym citations in running text.

Core Conventions

Acronyms With Built-in Citations (acro + biblatex)

  • bibsp.sty declares many crypto acronyms via \DeclareAcronym{...}{...}.
  • Many entries include cite = {<bibkey>}. When the acronym is used, acro can attach a citation.
  • In this project, preamble.tex should set:
    • \usepackage{bibsp}
    • \acsetup{cite/cmd=\autocite}
    • biblatex is configured so \autocite{...} produces footnote citations.

Practical rule: if an acronym exists in bibsp.sty, prefer \ac{...} over spelling it out manually, and let the citation happen automatically when configured.

Crypto Notation Macro Factories (Schemes, Algorithms, Variables, Sets)

Use the bibsp.sty factories to define consistent notation in the preamble for each paper/chapter.

Schemes

Define a scheme identifier that typesets as \mathsf{...} and supports optional “method” suffixes:

\NewScheme{\AE}{AE}

Use it like:

\AE[Enc] \textand \AE[Dec]

Algorithms and Functions

Define algorithm/function macros that behave like operators and accept optional argument lists.

\NewAlgorithm{\Enc}{Enc}
\NewAlgorithm{\Dec}{Dec}
\NewFunction{\Hash}{H}

Usage patterns:

c \gets \Enc[m]
\qquad
m \gets \Dec[c]
\qquad
h \gets \Hash[m]

The [...] optional argument adds parentheses, automatically using \left and \right.

Star form convention: most of these macros support a starred form (e.g., \Enc*) that draws an overline, used for “idealized/modified/adversarial” variants when you need that notation.

Variables and Sets

\NewVariable{\pk}{pk}
\NewVariable{\sk}{sk}
\NewSet{\UU}{U}

Variables typeset as math italic; sets as calligraphic.

Proof(-Of-Knowledge) Notation

Prefer the built-in statement macros for proofs:

We use a \ac{ZKPK} of knowledge:
$\PK[(w)]{\mathrm{stmt}(w)}$.

For Schnorr-style statements, use $\SPK[...]$ when appropriate.

(Exact \PK/\SPK usage depends on whether you include a witness list and/or side conditions; see bibsp.sty definitions if you need a specific shape.)

Common Patterns

Security Notions

  • Prefer the acronym if available: \ac{IND-CPA}, \ac{IND-CCA}, \ac{SUF-CMA}, \ac{INT-CTXT}, etc.
  • If you need the plain text tag in math/prose (without acronym management), bibsp.sty also provides helpers like \indcpa, \indcca.

Crypto Citations

  • If the concept is an acronym with a cite field in bibsp.sty, use \ac{...} and avoid adding a second manual citation.
  • Otherwise use \autocite{BibKey} in prose.

Notes For This Repository

  • Source of truth for the setup:
    • /home/dbosk/phd/thesis/preamble.tex
    • /home/dbosk/phd/thesis/bibsp.sty
  • Typical usage in body text across the thesis: .tex files use \autocite{...}, \citeauthor{...}, and \ac{...}.