danib31
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    --- title: Intro to Lattice-based Cryptography tags: presentation slideOptions: theme: simple # Black (default) - White - League - Sky - Beige - Simple - Serif - Blood - Night - Moon - Solarized transition: 'slide' # none/fade/slide/convex/concave/zoom #parallaxBackgroundImage: 'https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg' spotlight: enabled: false data-auto-animate: true --- ## Intro to Lattice-based Cryptography ### By Daniel Benarroch, July 2020 **Most pictures taken from [Daniele Micciancio's](https://simons.berkeley.edu/talks/basic-mathematics-lattices) & [Chris Peikert's](https://simons.berkeley.edu/talks/lwe-worst-case-average-case-reductions-and-cryptomania) presentations** --- ## Content Lattices - Motivation - What is a Lattice? - Important properties - Computational problems - Hard Problems from Lattices - Regev Encryption --- ## Motivation - **Mathematics:** used to bridge two fields - **Cryptanalysis:** many problems can be represented with lattices - **Post-quantum cryptography:** hard problems against QC ---- ### Applications - Symmetric crypto: PRF / Hashes - PKC: encryption and signatures (NIST competition) - Identity/Attribute-based encryption - **Homomorphic encryption** - Zero knowledge proofs --- ## What is a Lattice? <u>**Definition 1**</u> A lattice $\mathcal{L}$ of $\mathbb{R}^n$ is a discrete subgroup of $\mathbb{R}^n$ 1- *additive subgroup*: $\textbf{0} \in \mathcal{L}$, $-\textbf{x}, \textbf{x}+\textbf{y} \in \Lambda$ for every $\textbf{x}, \textbf{y} \in \mathcal{L}$ 2- *discrete*: every $\textbf{x} \in \mathcal{L}$ has a neighborhood in $\mathbb{R}^n$ in which $\textbf{x}$ is the only lattice point (We will talk about full-rank lattices only; i.e.: they span $\mathbb{R}^n$) ---- #### Example 1 Simplest $n$-dimensional lattice is $\mathcal{L} = \mathbb{Z}^n$ and $c\mathcal{L}$ for any $c \in \mathbb{R}$ ![](https://i.imgur.com/q1fllxc.png =500x) ---- <u>**Definition 2**</u> A lattice $\mathcal{L}$ is the set of all *integer* linear combinations of *linearly independent* basis vectors $\textbf{B} = \{\textbf{b}_1, ..., \textbf{b}_n\} \subset \mathbb{R}^{n}$ $\mathcal{L} = \textbf{B}\mathbb{Z}^n$ where $\textbf{B}\in \mathbb{R}^{d \times n}$ ![](https://i.imgur.com/oRv7BTp.png =500x) ---- #### Two definitions are equivalent $2 \implies 1$ 1. Existance of shortest vector is equivalent to having a discrete space 2. Parallepiped associated to basis is equivalent to coset group $2 \Longleftarrow 1$ 1. Group defines basis by picking linearly indep vectors. If it does not span $\mathcal{L}$, then find contraction about size of parallepiped ---- ### Lattice Basis We say the (integer) lattice is the span of its basis, written as $\begin{equation} \mathcal{L} = \sum^n_{i=1} \textbf{b}_i \cdot \mathbb{Z} = \left\{ \sum^n_{i=1}c_i \textbf{b}_i : c_i \in \mathbb{Z} \right\} \end{equation}$ where the generating basis matrix ---- ### Cosets As an additive subgroup, we can talk of the quotient group $\mathbb{R}^n / \mathcal{L}$ of cosets $\begin{equation} \textbf{c} + \mathcal{L} = \{\textbf{c} + \textbf{v} : \textbf{v} \in \mathcal{L} \}, \textbf{c} \in \mathbb{R}^n \end{equation}$ > Imagine taking the lattice and moving it around all over the underlying real space. Each position is a coset of the lattice > ---- ### Fundamental Region The fundamental region of the lattice is the parallepiped $\begin{equation} \mathcal{P}(\textbf{B}) := \textbf{B}\cdot \left[-\frac{1}{2}, \frac{1}{2} \right)^n \end{equation}$ Where different bases define different fundamental regions, all with the same volume, as $\mathrm{det}(\mathcal{L}) = \mathrm{vol}(\mathcal{P}(\textbf{B})) = |\mathbb{Z}^n / \mathcal{L}|$ ![](https://i.imgur.com/O7uzyKJ.png =300x) ![](https://i.imgur.com/XmGNAOQ.png =300x) ---- > Note that any fundamental region (for different basis and cosets), provides a standard set of representative elements for the coset. --- ## Other important metrics and measurements 1. Minimum distance 2. Successive minima 3. Distance function 4. Covering radius & Smoothing parameter ---- ### Minimum distance $\begin{eqnarray} \lambda_1 = \lambda_1(\mathcal{L}) &= \min_{\textbf{x}, \textbf{y}\in \Lambda; \textbf{x}\neq \textbf{y}} \|\textbf{x} - \textbf{y} \| \\ &= \min_{\textbf{x}\in \Lambda; \textbf{x}\neq \textbf{0}} \|\textbf{x}\| \end{eqnarray}$ ![](https://i.imgur.com/Zu5QqRn.png =300x) ---- where $\|\textbf{x}\| = \sqrt{x_1^2 + ... + x_n^2}$ > Note that $\lambda_1$ is easy to compute in 2D (Lagrange), but hard in $n$D ---- ### Successive minima The $i$-th successive minimum $\lambda_i(\mathcal{L})$ is the smallest $r$ s.t. $\mathcal{L}$ has $i$ linearly independent vectors of norm at most $r$ Trivial example is in $\mathbb{Z}^n$: $\lambda_1 = \lambda_2 = ... = \lambda_n = 1$ ![](https://i.imgur.com/Ka51iy8.png =300x) ---- ### Bounds on $\lambda_i$ - Minkowski #1 $\rightarrow \lambda_1 \leq \sqrt{n}(\det \mathcal{L})^{\frac{1}{n}}$ - Minkowski #2 $\rightarrow (\prod_{i=1}^n \lambda_i)^{\frac{1}{n}} \leq \sqrt{n}(\det \mathcal{L})^{\frac{1}{n}}$ Very analytical proofs. --- ## Some computational problems From SVP to BDD ---- ### Shortest Vector Problem (SVP) > For an arbitrary basis $\textbf{B}$ of a lattice $\mathcal{L}$, find the shortest non-zero lattice vector: $\textbf{v} \in \mathcal{L}$ s.t. $\|\textbf{v}\| = \lambda_1(\mathcal{L})$. We write $\textbf{v} = \textbf{B}\textbf{x}$ for $\textbf{x} \in \mathbb{Z}^n$ ![](https://i.imgur.com/4kohf2v.png =500x) ---- ### Approximate & Decisional - Approximate SVP (SVP$_{\gamma}$) $\rightarrow \|\textbf{v}\| \leq \gamma(n)\cdot \lambda_1(\mathcal{L})$ - Decisional approx SVP (GapSVP$_{\gamma}$) $\rightarrow \text{ determine } \lambda_1 \leq 1 \text{ or } \lambda_1 > \gamma(n)$ ---- ### Approximate SIVP$_{\gamma}$ For an arbitrary basis $\textbf{B}$ of a full-rank, $n$-dimensional lattice, output $\textbf{S} = \{\textbf{s}_i\} \subset\mathcal{L}(\textbf{B})$ of $n$ linearly indep. lattice vectors where $\|\textbf{s}_i\| \leq \gamma(n)\cdot \lambda_n\mathcal{L}$ for all i. ![](https://i.imgur.com/WkZKsAJ.png =500x) ---- ### State-of-the-art Attacks These are well studied problems: - Lenstra, Lenstra, and Lovasz (LLL) algorithm most well known, **polynomial time for sub-exponential approx factors** - For polynomial approx factors, only **~exponential time and space** IMPORTANT: this is also state for quantum algorithms --- ## One more important problem ---- ### Distance function For any point $\textbf{t} \in \mathbb{R}^n$, define the distance to the lattice $\begin{equation} \mu(\textbf{t}, \mathcal{L}) = \min_{\textbf{x}\in \mathcal{L}} \|\textbf{t} - \textbf{x}\| \end{equation}$ ---- - One can ask the question of how close is any point to the lattice? Closest Vector Problem (not THAT interesting for crypto) - Used in coding theory to study level of noise in communication channel ![](https://i.imgur.com/FLkTfAe.png) ---- ### Bounded Distance Decoding (BDD$_{\gamma}$) Problem > Given $(\mathcal{L}, \textbf{t}, d)$ s.t. > $\begin{equation} \mu(\textbf{t}, \mathcal{L}) < d = \lambda_1 / (2\gamma(n)) \end{equation}$ > find **unique** $\textbf{v} \in \mathcal{L}$ where s.t. $\|\textbf{t} - \textbf{v}\| < d$ Vector assured to exist; remove the condition to get CVP. ---- ![](https://i.imgur.com/qguG8rC.png) --- ## Using noise in lattices ---- ### Covering radius Is maximum distance between the lattice and any point in the span of the lattice: $\begin{equation} \mu(\mathcal{L}) = \max_{\textbf{t} \in span(\mathcal{L})} \mu(\textbf{t}, \mathcal{L}) \end{equation}$ Spheres of radius $\mu(\mathcal{L})$ cover the whole space ![](https://i.imgur.com/rnOxyAc.png) ---- ### Smoothing lattices Now imagine adding more and more noise to make uniform distribution > Radius at most $\|\textbf{r}\| \leq (\log n) \cdot \sqrt{n} \lambda_n$ ![](https://i.imgur.com/IV6nfbV.png) ![](https://i.imgur.com/rsSw0tQ.png) ---- ### Smoothing parameter *Best done with Gaussian noise of width $|r_i| \approx \eta_{\epsilon} \leq (\log n) \lambda_n$* We call $\eta_{\epsilon}$ the smoothing parameter, with several technical results. > Think about it as the amount of "blur" needed to smooth out the lattice. --- ## Discrete Gaussian Distributions We recall the basic concepts and definitions, which are used in cryptosystems to make problems hard. ---- ### Gaussian function For any integer $n\geq 1$ and real $s>0$, define Gaussian function of width $s$: > $\begin{equation} \rho_s(\textbf{x}) := \exp(-\pi\|\textbf{x}\|^2/s^2)\end{equation}$ Where $\rho_s(\textbf{x}) = \prod_{i=0}^n \rho_s(x_i)$; in the continuous setting, it defines a normal distribution ![](https://i.imgur.com/ytqVMqo.png =200x) ---- ### Discrete Gaussian probability > Defined for a coset $\textbf{c}+ \mathcal{L} \subset \mathbb{R}^n$ and parameter $s>0$, discrete Gaussian by restriction $\begin{equation} D_{\textbf{c} + \mathcal{L}, s}(\textbf{x}) \propto \rho_s(\textbf{x}) \text{ if } \textbf{x} \in \textbf{c} + \mathcal{L} \text{; or } 0 \text{ otherwise.} \end{equation}$ ---- ### Sampling > For any basis $\textbf{B}$ of a lattice $\mathcal{L}$, for any coset $\textbf{c}+\mathcal{L}$, and any Gaussian $s \geq K$, there is an randomized, poly-time algorithm that outputs a sample of $\mathcal{L}$ that is within statistical distance $\epsilon$ of $D_{\textbf{c}+\mathcal{L}, s}$ ---- ### Algos - A variation of "nearest plane" algorithm by Babai'85 is first well known sampling algo, but innefficient. - Peikert'10 came up with a novel "perturbation" sampling that is quasi-linear - Brakerski and more... --- ## Cryptographic problems Foundations and the all-encompassing problem, learning with errors ---- ### q-ary Lattices Cryptography likes to work modulo some integer, $q$. In lattices, the reason is in connection to worst-case vs average-case reductions. > $\mathcal{L} \subseteq \mathbb{Z}^n$ is integer lattice > $q\mathbb{Z}^n \subseteq \mathcal{L}$ is periodic modulo small $q$ Functions based on q-are lattices use modulo arithmetic ---- Standard way of building such lattice: Take matrix $\mathcal{L}_q(\textbf{A}) = \{ \textbf{x} | \textbf{x} \mod q = \textbf{A}\textbf{u}\textit{ for } \textbf{u} \in \mathbb{Z}^n_q \} \subseteq \mathbb{Z}^n$ - Consider image of $\textbf{A}$, lattice spanned by it - Can also consider the kernel of this where $\textbf{Au} = 0 \mod q$ and these are reciprocal conditions ---- Confusing note: > in cryptography one does not need to think about lattices. In some sense, lattices are so nice, that they can apply "post-cryptography" and things will work out. ---- ### Short Integer Solution (SIS) This problem has applications in symmetric crypto. Informally: for random uniform elements in a group, find an integer linear combination that sums to zero. ---- **Parameters** - $n$ number of dimensions, main hardness - $q$ defines the group $\mathbb{Z}^n_q$ (think $q \approx n^2)$ - $\beta$ positive real - $m$ number of elements ---- #### SIS$_{n,q,\beta, m}$ For $n$ uniformly random vectors $\textbf{a}_i \in \mathbb{Z}^m_q$, rows of matrix $\textbf{A} \in \mathbb{Z}^{n\times m}_q$, find non-zero integer vector $\textbf{z} \in \mathbb{Z}^m$ of short norm $\|\textbf{z}\| \leq \beta$ s.t. > $\begin{equation} f_{\textbf{A}}(\textbf{z}) := \textbf{Az} = \sum_{i=1}^m \textbf{a}_i \cdot z_i = 0 \in \mathbb{Z}^n_q \end{equation}$ ---- **Intuition** By Gaussian elimition, this would be easy, but large $\textbf{z}$ vector, so require it to be small - must take $\beta < q$ or trivial solution $\textbf{z}=(q,0,...,0)$ would be legit - $\beta$ and $m$ must be large enought to ensure existence ---- **Reductions** - Ajtai'96: SIS reduced GapSVP$_{\gamma}$ and GapSIVP$_{\gamma}$ in the worst-case for $\gamma = \beta\cdot poly(n)$ and $q \geq \beta\cdot poly(n)$ - Best result today by Micciancio and Peikert'13: much lower $q$ and $\gamma$, so smaller keys and stronger guarantees ---- ### Ajtai CRF Think of SIS as a function: $\begin{equation} f_{\textbf{A}}(\textbf{x}) = \textbf{Ax} \mod q \end{equation}$ ![](https://i.imgur.com/98fak6Z.png) ---- **Concretely** - Parameters: $m,n,q \in \mathbb{Z}$ - Key: $\textbf{A} \in \mathbb{Z}_q^{n\times m}$ - Input: $\textbf{x} \in \{0,1\}^m$ - Output: $f_{\textbf{A}}(\textbf{x}) = \textbf{Ax} \mod q$ ---- **CR** If collision > $\textbf{Ax} = \textbf{Ax}' \rightarrow \textbf{Az} = \textbf{A}(\textbf{x}-\textbf{x}') = 0$ where $\textbf{z}$ is short, solution to SIS ---- **Also it is a one-way function** > If SIVP is hard, then $f$ is a one-way function for $m> n \log q$ ---- **Remember the confusing note?** Note that the $q$-ary lattice $\mathcal{L}'_q(\textbf{A})$ is the kernel of $f_{\textbf{A}}$ - Finding collisions $f_{\textbf{A}}(\textbf{x}) = f_{\textbf{A}}(\textbf{y})$ is equivalent to finding short vectors (SIVP) - Inverting it is equivalent to CVP under some conditions We applied lattices given matrices and vectors (integers, modulo $q$) ---- ### Regev'05 Learning With Errors Informally search version: given many noisy inner products $<\textbf{s},\textbf{a}_i> + e_i$ find the secret $\textbf{s}$ common to all Note that without the error, easy to solve as set of linear equations by Gaussian elimination. ---- **Parameters:** - dimension $n$ - modulus $q = poly(n)$ - error distribution $\chi$ on $\mathbb{Z}_q$ ---- **Search Problem** Given arbitrary samples below, find $\textbf{s} \in \mathbb{Z}_q^n$ ![](https://i.imgur.com/bGU3jpw.png) ---- **Other form** $g_{\textbf{A}}(\textbf{s};\textbf{e}) = \textbf{As} + \textbf{e} \mod q$ > Given $\textbf{A}$ and $g_{\textbf{A}}(\textbf{s};\textbf{e})$, recover $\textbf{s}$ ![](https://i.imgur.com/8NtFvv3.png) ---- **Error Distribution** Think of Gaussian / normal distribution such that stdDev $= \alpha q$ ![](https://i.imgur.com/GQdLJfJ.png) ---- **Decision version** Differentiate between distributions $\begin{equation} (\textbf{A}, \textbf{b}) \approx (\textbf{A}, \textbf{u}) \end{equation}$ where $\textbf{u} \in \mathbb{Z}_q^m$ is uniformly random. ---- **LWE as lattice problem** related to the BDD problem > $\textbf{v} \in \mathcal{L}$ where s.t. $\|\textbf{t} - \textbf{v}\| < d$ > $\textbf{v} \in \mathcal{L}$ where s.t. $\|\textbf{t} - \textbf{v}\|$ is small > $\textbf{x} \in \mathbb{Z}_q^n$ where s.t. $\textbf{Ax}+e - \textbf{Ax} \approx 0$ ---- **Reductions** $g_{\textbf{A}}$ is hard to invert on average. Assuming GapSVP, LWE is hard in the worst-case. GapSVP, SIVP $\leq$ search-LWE $\leq$ decision-LWE $\leq$ Crypto > search-LWE $\equiv$ decision-LWE ---- **Intuition and Quantumness** - Best known algoritms (even in quantumness run in exponential time) - Average-case = worst-case (every problem in the family is hard). - For any classical alg to solve search-LWE it can translate into quantum alg to solve decision-LWE > This and the fact that there is no quantum algorithm to solve SVP makes us think it is post-quantum resistant --- ## Cryptographic applications Regev encryption scheme is used as a basis for many other schemes ---- ### Public-key encryption scheme from LWE [Regev05, GPV08] Say, Alice and Bob want to communicate. Bob will send a message to Alice. #### Public set up: $parameters = \mathrm{Gen}(\lambda)$ - $n, q, m, \chi$ - Sample $\textbf{A} \in \mathbb{Z}^{n\times m}_q$ ---- #### Key generation: $(sk, pk) = \mathrm{Gen}(\textbf{A}, m, n, q)$ - Sample short vector $sk = \textbf{x} \leftarrow \mathbb{Z}^m$ - Compute $pk = \textbf{u} = \textbf{A}\textbf{x}$ > for parameters, if $m > n \log q$ then public key is uniform random vector by LHL ---- #### Encryption: $(\textbf{b}^t, b') = \mathrm{Enc}(bit, \textbf{u})$ - Bob wants to encrypt $bit \in \{0,1\}$ - Sample secret $\textbf{s} \in \mathbb{Z}_q^n$ - Computes "preamble" LWE vector $\begin{equation} \textbf{b}^t = \textbf{s}^t \textbf{A} + \textbf{e}^t \end{equation}$ - Computes payload $\begin{equation} b' = \textbf{s}^t\textbf{u} + e' + bit\cdot \frac{q}{2} \end{equation}$ ---- #### Decryption: $bit = \mathrm{Dec}(\textbf{b}^t, \textbf{b}', \textbf{x})$ Alice computes $\begin{eqnarray} & \textbf{b}' - \textbf{b}^t \cdot \textbf{x} \\ = & \textbf{s}^t\cdot \textbf{u} - \textbf{s}^t\textbf{Ax} - \textbf{e}^t\textbf{x}+ e' + bit\cdot \frac{q}{2} \\ = & smallError + bit\cdot \frac{q}{2} \end{eqnarray}$ If result is small, then $bit=0$, otherwise $bit =1$ ---- **Putting it together** ![](https://i.imgur.com/N4U001n.png) ---- **Security** - Eve sees $(\textbf{A},\textbf{u}), (\textbf{b}^t, b')$ - This is LWE samples by multiplying by $\textbf{s}$ - If change the latter with truly uniform samples, $bit$ is hidden informational theoretically - So based on decision-LWE ---- # Thank You! ![](https://i.imgur.com/4rVEsHh.png) --- ## Bibliography [[MicSim20a]](https://simons.berkeley.edu/talks/basic-mathematics-lattices) Daniele Micciancio, *Mathematics of Lattices*, Lattices Bootcamp at Simons Institute [[MicSim20b]](https://simons.berkeley.edu/talks/sis-worst-case-average-case-reductions-and-minicrypt), Daniele Micciancio, *The Short Integer Solutions Problem and Cryptographic Applications*, Lattices Bootcamp at Simons Institute [[PeiSim20a]](https://simons.berkeley.edu/talks/lwe-worst-case-average-case-reductions-and-cryptomania) Chris Peikert, *The Learning With Errors Problem and Cryptographic Applications*, Lattices Bootcamp at Simons Institute [[RegLWE]](https://cims.nyu.edu/~regev/papers/lwesurvey.pdf) Oded Regev, *The Learning with Errors Problem*, survey published online

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully