import{_ as m,c as e,a as n,e as l,b as s,r as p,o as i}from"./app-CsTq_I9B.js";const r={};function c(o,a){const t=p("Mermaid");return i(),e("div",null,[a[0]||(a[0]=n('
密码学(Cryptography) 是一门研究信息安全的学科,主要关注如何在不安全的环境中实现安全通信。其核心是通过数学方法对信息进行变换,使得只有授权方能够理解信息内容。
密码学追求以下四个主要安全目标:
密码学在现代信息安全中扮演着至关重要的角色:
为方便初学者快速建立直觉,先认识密码学中最核心的几个概念:
明文(Plaintext)与密文(Ciphertext)
加密(Encryption)与解密(Decryption)
其中, 表示明文, 表示密文, 表示密钥, 为加密算法, 为解密算法。
密钥(Key):对称密钥 vs 非对称密钥
对称加密流程示意(同一把密钥):
',24)),l(t,{code:"eJxLy8kvT85ILCpR8AniUlAIjn7aP/FlQ+OLhtZYBV1dhSd79z+fsuJp68Ynu1Y/Xd/2ctJSBW+Fp10LgGygtJ2Cc7QGkPlsWrtmLFC3M04tL5YvhmkJin7Wt/TZlG0gK7gAfgE/qw=="}),a[1]||(a[1]=s("p",null,"非对称加密流程示意(公钥/私钥):",-1)),l(t,{code:"eJxLy8kvT85ILCpR8AniUlAIjn7aP/FlQ+OLhtZYBV1dhSd79z+fsuJZ39JnU7YBxZ62rnk5aenTrgVP17cBpe0UnKM1gMxn09o1Y4G6nbFoeb68EajlxfLFMC1B0XC5WC4A+5BCKg=="}),a[2]||(a[2]=s("p",null,"在典型的 RSA 公钥体制中,还可以用一个简洁的数学表达式表示加解密:",-1)),a[3]||(a[3]=s("p",{class:"katex-block"},[s("span",{class:"katex-display"},[s("span",{class:"katex"},[s("span",{class:"katex-mathml"},[s("math",{xmlns:"http://www.w3.org/1998/Math/MathML",display:"block"},[s("semantics",null,[s("mtable",{rowspacing:"0.25em",columnalign:"right left",columnspacing:"0em"},[s("mtr",null,[s("mtd",null,[s("mstyle",{scriptlevel:"0",displaystyle:"true"},[s("mi",null,"c")])]),s("mtd",null,[s("mstyle",{scriptlevel:"0",displaystyle:"true"},[s("mrow",null,[s("mrow"),s("mo",null,"="),s("msup",null,[s("mi",null,"m"),s("mi",null,"e")]),s("mtext",null," "),s("mo",{lspace:"0.22em",rspace:"0.22em"},[s("mrow",null,[s("mi",{mathvariant:"normal"},"m"),s("mi",{mathvariant:"normal"},"o"),s("mi",{mathvariant:"normal"},"d")])]),s("mtext",null," "),s("mi",null,"n"),s("mo",{separator:"true"},",")])])])]),s("mtr",null,[s("mtd",null,[s("mstyle",{scriptlevel:"0",displaystyle:"true"},[s("mi",null,"m")])]),s("mtd",null,[s("mstyle",{scriptlevel:"0",displaystyle:"true"},[s("mrow",null,[s("mrow"),s("mo",null,"="),s("msup",null,[s("mi",null,"c"),s("mi",null,"d")]),s("mtext",null," "),s("mo",{lspace:"0.22em",rspace:"0.22em"},[s("mrow",null,[s("mi",{mathvariant:"normal"},"m"),s("mi",{mathvariant:"normal"},"o"),s("mi",{mathvariant:"normal"},"d")])]),s("mtext",null," "),s("mi",null,"n"),s("mo",{separator:"true"},",")])])])])]),s("annotation",{encoding:"application/x-tex"},"\\begin{aligned} c &= m^{e} \\bmod n,\\\\ m &= c^{d} \\bmod n, \\end{aligned} ")])])]),s("span",{class:"katex-html","aria-hidden":"true"},[s("span",{class:"base"},[s("span",{class:"strut",style:{height:"3.0591em","vertical-align":"-1.2796em"}}),s("span",{class:"mord"},[s("span",{class:"mtable"},[s("span",{class:"col-align-r"},[s("span",{class:"vlist-t vlist-t2"},[s("span",{class:"vlist-r"},[s("span",{class:"vlist",style:{height:"1.7796em"}},[s("span",{style:{top:"-3.9396em"}},[s("span",{class:"pstrut",style:{height:"3em"}}),s("span",{class:"mord"},[s("span",{class:"mord mathnormal"},"c")])]),s("span",{style:{top:"-2.3804em"}},[s("span",{class:"pstrut",style:{height:"3em"}}),s("span",{class:"mord"},[s("span",{class:"mord mathnormal"},"m")])])]),s("span",{class:"vlist-s"},"")]),s("span",{class:"vlist-r"},[s("span",{class:"vlist",style:{height:"1.2796em"}},[s("span")])])])]),s("span",{class:"col-align-l"},[s("span",{class:"vlist-t vlist-t2"},[s("span",{class:"vlist-r"},[s("span",{class:"vlist",style:{height:"1.7796em"}},[s("span",{style:{top:"-3.9396em"}},[s("span",{class:"pstrut",style:{height:"3em"}}),s("span",{class:"mord"},[s("span",{class:"mord"}),s("span",{class:"mspace",style:{"margin-right":"0.2778em"}}),s("span",{class:"mrel"},"="),s("span",{class:"mspace",style:{"margin-right":"0.2778em"}}),s("span",{class:"mord"},[s("span",{class:"mord mathnormal"},"m"),s("span",{class:"msupsub"},[s("span",{class:"vlist-t"},[s("span",{class:"vlist-r"},[s("span",{class:"vlist",style:{height:"0.7144em"}},[s("span",{style:{top:"-3.113em","margin-right":"0.05em"}},[s("span",{class:"pstrut",style:{height:"2.7em"}}),s("span",{class:"sizing reset-size6 size3 mtight"},[s("span",{class:"mord mtight"},[s("span",{class:"mord mathnormal mtight"},"e")])])])])])])])]),s("span",{class:"mspace",style:{"margin-right":"0.0556em"}}),s("span",{class:"mspace",style:{"margin-right":"0.2222em"}}),s("span",{class:"mbin"},[s("span",{class:"mord"},[s("span",{class:"mord mathrm"},"mod")])]),s("span",{class:"mspace",style:{"margin-right":"0.0556em"}}),s("span",{class:"mspace",style:{"margin-right":"0.2222em"}}),s("span",{class:"mord mathnormal"},"n"),s("span",{class:"mpunct"},",")])]),s("span",{style:{top:"-2.3804em"}},[s("span",{class:"pstrut",style:{height:"3em"}}),s("span",{class:"mord"},[s("span",{class:"mord"}),s("span",{class:"mspace",style:{"margin-right":"0.2778em"}}),s("span",{class:"mrel"},"="),s("span",{class:"mspace",style:{"margin-right":"0.2778em"}}),s("span",{class:"mord"},[s("span",{class:"mord mathnormal"},"c"),s("span",{class:"msupsub"},[s("span",{class:"vlist-t"},[s("span",{class:"vlist-r"},[s("span",{class:"vlist",style:{height:"0.8991em"}},[s("span",{style:{top:"-3.113em","margin-right":"0.05em"}},[s("span",{class:"pstrut",style:{height:"2.7em"}}),s("span",{class:"sizing reset-size6 size3 mtight"},[s("span",{class:"mord mtight"},[s("span",{class:"mord mathnormal mtight"},"d")])])])])])])])]),s("span",{class:"mspace",style:{"margin-right":"0.0556em"}}),s("span",{class:"mspace",style:{"margin-right":"0.2222em"}}),s("span",{class:"mbin"},[s("span",{class:"mord"},[s("span",{class:"mord mathrm"},"mod")])]),s("span",{class:"mspace",style:{"margin-right":"0.0556em"}}),s("span",{class:"mspace",style:{"margin-right":"0.2222em"}}),s("span",{class:"mord mathnormal"},"n"),s("span",{class:"mpunct"},",")])])]),s("span",{class:"vlist-s"},"")]),s("span",{class:"vlist-r"},[s("span",{class:"vlist",style:{height:"1.2796em"}},[s("span")])])])])])])])])])])],-1)),a[4]||(a[4]=n('其中 为公钥, 为私钥, 为明文, 为密文。
常见攻击模型简介(只需直观理解)
直观结论:设计良好的现代密码系统,应当在这些攻击模型下仍保持安全(在合理的参数与假设下)。
凯撒密码(Caesar Cipher)
斯巴达密码棒(Scytale)
古典密码简述:
维吉尼亚密码(Vigenère Cipher)
博福特密码(Beaufort Cipher)
恩尼格玛密码机(Enigma)
香农的信息论
DES算法
RSA算法
AES算法
现代密码简述:
公元前5世纪:斯巴达密码棒
公元前1世纪:凯撒密码
16世纪:维吉尼亚密码
1918年:一次一密密码本
1949年:香农信息论
1977年:DES和RSA算法
2001年:AES标准密码学作为信息安全的基石,经历了从简单替换到复杂数学算法的漫长发展历程。现代密码学建立在严格的数学基础之上,通过对称加密、非对称加密等多种技术手段,为数字世界提供了可靠的安全保障。
理解密码学的基本原理和分类,有助于我们更好地应用这些技术来保护信息安全,同时也为深入学习更高级的密码学概念奠定基础。
本篇笔记的所有代码开源于:https://gitea.simengweb.com/si-meng-spec/cryptography-example-code
`,7))])}const g=m(r,[["render",c]]),d=JSON.parse('{"path":"/theory/cryptography/","title":"密码学基础","lang":"zh-CN","frontmatter":{"title":"密码学基础","createTime":"2025/10/27 10:38:57","permalink":"/theory/cryptography/"},"readingTime":{"minutes":5.34,"words":1603},"git":{"createdTime":1761564580000,"updatedTime":1761716737000,"contributors":[{"name":"祀梦","username":"","email":"3501646051@qq.com","commits":2,"avatar":"https://gravatar.com/avatar/6406a81eeddc359cf3d3ce018797689fc6d014ff06215c27d0210b42e8f5a8ab?d=retro"}]},"filePathRelative":"notes/theory/cryptography/README.md","headers":[]}');export{g as comp,d as data};