CryptoBase

A lightweight knowledge base for mathematics and cryptography notes.

Keyboard shortcuts

  • / search (reveals the topbar first) · t toggle theme · \ topbar (reveal if hidden, else hide)
  • [ / ] toggle left / right sidebar · Esc close dialogs and unfocus
  • j / k scroll down / up · h / l previous / next page
  • g jump to top · G jump to bottom

Graph view

See the graph for a visual map of every note and how they link together, or browse the chapters index.

Authoring reference

Everything below is live documentation: copy these patterns into any note. New chapters are folders under content/ with an _index.md (sort_by = "weight" plus a weight); pages need a weight too — weightless pages are silently dropped when the section sorts by weight. Cross-link with Zola internal links like Euler’s theorem — they become backlinks and graph edges automatically.

Callouts

Admonition syntax and kb.callout render the same CSS. All five types:

Info Info Callouts use admonition syntax, or the equivalent kb.callout shortcode.

Tip Tip Prefer $\equiv$ over $=$ for congruences.

Important Crypto relevance RSA decryption correctness rests on Euler’s theorem.

Warning Hypothesis check The coprimality condition is essential: $2^2 \equiv 1 \pmod{4}$ is false.

Example Example callout $7^{-1} \equiv 13 \pmod{15}$ since $7 \cdot 13 = 91 \equiv 1$.

Custom title

Same box via shortcode. Types: info, important, tip, warning, example.

Theorem environments (numbered, linkable)

Numbering is automatic per type (CSS counters, per-page). Add label="…" to any box to anchor it, then link with <a href="#label">text</a>. (Plain markdown [text](#label) fails zola check — it only knows header ids — so box cross-refs use raw <a href>.)

Definition (Congruence). §

$a \equiv b \pmod{n}$ iff $n \mid (a - b)$.

Theorem (Euler). §

If $\gcd(a, n) = 1$ then $a^{\varphi(n)} \equiv 1 \pmod{n}$.

Theorem above is Euler’s theorem; Definition is congruence.

Lemma . §

If $\gcd(a, n) = 1$ and $ab \equiv ac \pmod{n}$ then $b \equiv c \pmod{n}$.

Example (Inverse). §

$7^{-1} \equiv 13 \pmod{15}$.

Remark . §

Remarks share the box style with their own accent color.

Notation . §

$\varphi(n)$ counts units modulo $n$.

Proof. §

The units modulo $n$ form a group of order $\varphi(n)$; apply Lagrange.

The proof is unnumbered but linkable just like the rest (the ∎ is added automatically — don’t type it yourself).

Why does RSA work?

Long derivations fold away. The modular arithmetic note covers inverses; Euler’s theorem lifts it to full RSA correctness. Link directly: Why RSA works.

Full shortcode list: kb.definition, kb.theorem, kb.lemma, kb.example, kb.proof, kb.remark, kb.notation, kb.details. Each takes name="…" (except proof) plus optional label="…"; details takes summary="…" plus optional label="…" and renders a native <details> element.

Math and numbered equations

Inline math ($e^{i\pi} + 1 = 0$) and unnumbered display math:

$$ \sum_{k=1}^{n} k = \frac{n(n+1)}{2} $$

Numbered equations use the equation environment with \label / \eqref:

\begin{equation} a^{\varphi(n)} \equiv 1 \pmod{n} \label{eq:euler} \end{equation}

Equation \eqref{eq:euler} is Euler’s theorem again, this time referenceable. Math renders with MathML included for screen readers.

Code (line numbers, highlights, copy button)

Basic numbered block with one highlighted line:

def egcd(a, b):
    if b == 0:          # highlighted line
        return (a, 1, 0)
    g, x1, y1 = egcd(b, a % b)
    return (g, y1, x1 - (a // b) * y1)

Start numbering at 10 with a range highlight:

def egcd(a, b):
    if b == 0:
        return (a, 1, 0)
    g, x1, y1 = egcd(b, a % b)   # highlighted
    return (g, y1, x1 - (a // b) * y1)  # highlighted

Hide boilerplate lines from display (still copied):

def egcd(a, b):
    if b == 0:
        return (a, 1, 0)

Hover any block for the copy button. Inline code uses single backticks.

Tables (scroll on mobile)

angcdinvertible?
7151yes
6153no

Wide tables scroll horizontally inside the page on small screens.

Frontmatter (byline, both optional)

author and proofread_by live in [extra]. Each is shown only when present — omit both and no byline renders (as on this homepage):

[extra]
author = "Alice"
proofread_by = "Bob"

Diagrams

Pre-rendered SVG: crisp in both themes, click to enlarge

Commit SVGs to static/diagrams/ and reference them with kb.figure (alt is required, caption optional). Strokes follow the theme automatically; click enlarges with keyboard trap and Esc to close.

For quick drafts only, set [extra] tikz = true and embed a <script type="text/tikz">…</script> block (client-side TikZJax, needs network).