import{_ as n,c as t,a as m,b as Q,d as a,o as l}from"./app-C2jws1hx.js";const e={},s={class:"MathJax",jax:"SVG",style:{position:"relative"}},o={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"21.518ex",height:"2.262ex",role:"img",focusable:"false",viewBox:"0 -750 9511.1 1000","aria-hidden":"true"},d={class:"MathJax",jax:"SVG",style:{position:"relative"}},r={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"28.9ex",height:"2.262ex",role:"img",focusable:"false",viewBox:"0 -750 12773.6 1000","aria-hidden":"true"},i={class:"MathJax",jax:"SVG",style:{position:"relative"}},g={style:{"vertical-align":"-0.339ex"},xmlns:"http://www.w3.org/2000/svg",width:"3.182ex",height:"1.885ex",role:"img",focusable:"false",viewBox:"0 -683 1406.6 833","aria-hidden":"true"},h={class:"MathJax",jax:"SVG",style:{position:"relative"}},H={style:{"vertical-align":"-0.339ex"},xmlns:"http://www.w3.org/2000/svg",width:"3.182ex",height:"1.885ex",role:"img",focusable:"false",viewBox:"0 -683 1406.6 833","aria-hidden":"true"},p={class:"MathJax",jax:"SVG",style:{position:"relative"}},L={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"16.298ex",height:"2.262ex",role:"img",focusable:"false",viewBox:"0 -750 7203.9 1000","aria-hidden":"true"},u={class:"MathJax",jax:"SVG",style:{position:"relative"}},M={style:{"vertical-align":"0"},xmlns:"http://www.w3.org/2000/svg",width:"2.378ex",height:"1.545ex",role:"img",focusable:"false",viewBox:"0 -683 1051 683","aria-hidden":"true"},f={class:"MathJax",jax:"SVG",style:{position:"relative"}},w={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"11.146ex",height:"2.262ex",role:"img",focusable:"false",viewBox:"0 -750 4926.4 1000","aria-hidden":"true"},V={class:"MathJax",jax:"SVG",style:{position:"relative"}},x={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"25.512ex",height:"2.262ex",role:"img",focusable:"false",viewBox:"0 -750 11276.4 1000","aria-hidden":"true"},Z={class:"MathJax",jax:"SVG",style:{position:"relative"}},c={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"17.464ex",height:"2.262ex",role:"img",focusable:"false",viewBox:"0 -750 7719.3 1000","aria-hidden":"true"},v={class:"MathJax",jax:"SVG",style:{position:"relative"}},y={style:{"vertical-align":"-0.439ex"},xmlns:"http://www.w3.org/2000/svg",width:"3.185ex",height:"1.439ex",role:"img",focusable:"false",viewBox:"0 -442 1407.7 636","aria-hidden":"true"},b={class:"MathJax",jax:"SVG",style:{position:"relative"}},D={style:{"vertical-align":"-0.439ex"},xmlns:"http://www.w3.org/2000/svg",width:"6.553ex",height:"1.758ex",role:"img",focusable:"false",viewBox:"0 -583 2896.6 777","aria-hidden":"true"},j={class:"MathJax",jax:"SVG",style:{position:"relative"}},C={style:{"vertical-align":"-0.025ex"},xmlns:"http://www.w3.org/2000/svg",width:"1.357ex",height:"1.025ex",role:"img",focusable:"false",viewBox:"0 -442 600 453","aria-hidden":"true"},B={class:"MathJax",jax:"SVG",style:{position:"relative"}},k={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"7.931ex",height:"2.262ex",role:"img",focusable:"false",viewBox:"0 -750 3505.6 1000","aria-hidden":"true"},S={class:"MathJax",jax:"SVG",style:{position:"relative"}},J={style:{"vertical-align":"-0.464ex"},xmlns:"http://www.w3.org/2000/svg",width:"15.058ex",height:"2.351ex",role:"img",focusable:"false",viewBox:"0 -833.9 6655.4 1038.9","aria-hidden":"true"},G={class:"MathJax",jax:"SVG",style:{position:"relative"}},A={style:{"vertical-align":"-0.464ex"},xmlns:"http://www.w3.org/2000/svg",width:"1.109ex",height:"1.464ex",role:"img",focusable:"false",viewBox:"0 -442 490 647","aria-hidden":"true"},E={class:"MathJax",jax:"SVG",style:{position:"relative"}},q={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"16.755ex",height:"2.452ex",role:"img",focusable:"false",viewBox:"0 -833.9 7405.8 1083.9","aria-hidden":"true"},F={class:"MathJax",jax:"SVG",style:{position:"relative"}},N={style:{"vertical-align":"-0.439ex"},xmlns:"http://www.w3.org/2000/svg",width:"9.09ex",height:"1.946ex",role:"img",focusable:"false",viewBox:"0 -666 4017.8 860","aria-hidden":"true"},O={class:"MathJax",jax:"SVG",style:{position:"relative"}},R={style:{"vertical-align":"-0.025ex"},xmlns:"http://www.w3.org/2000/svg",width:"3.682ex",height:"1.742ex",role:"img",focusable:"false",viewBox:"0 -759 1627.5 770","aria-hidden":"true"},P={class:"MathJax",jax:"SVG",style:{position:"relative"}},z={style:{"vertical-align":"-0.186ex"},xmlns:"http://www.w3.org/2000/svg",width:"6.233ex",height:"1.903ex",role:"img",focusable:"false",viewBox:"0 -759 2755 841","aria-hidden":"true"},X={class:"MathJax",jax:"SVG",style:{position:"relative"}},I={style:{"vertical-align":"-0.186ex"},xmlns:"http://www.w3.org/2000/svg",width:"10.356ex",height:"1.903ex",role:"img",focusable:"false",viewBox:"0 -759 4577.5 841","aria-hidden":"true"},K={class:"MathJax",jax:"SVG",style:{position:"relative"}},U={style:{"vertical-align":"-0.025ex"},xmlns:"http://www.w3.org/2000/svg",width:"1.294ex",height:"1.025ex",role:"img",focusable:"false",viewBox:"0 -442 572 453","aria-hidden":"true"},W={class:"MathJax",jax:"SVG",style:{position:"relative"}},Y={style:{"vertical-align":"-0.439ex"},xmlns:"http://www.w3.org/2000/svg",width:"3.185ex",height:"1.439ex",role:"img",focusable:"false",viewBox:"0 -442 1407.7 636","aria-hidden":"true"},$={class:"MathJax",jax:"SVG",style:{position:"relative"}},_={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"30.082ex",height:"2.262ex",role:"img",focusable:"false",viewBox:"0 -750 13296.1 1000","aria-hidden":"true"},Q1={class:"MathJax",jax:"SVG",style:{position:"relative"}},T1={style:{"vertical-align":"-0.439ex"},xmlns:"http://www.w3.org/2000/svg",width:"6.553ex",height:"1.758ex",role:"img",focusable:"false",viewBox:"0 -583 2896.6 777","aria-hidden":"true"},a1={class:"MathJax",jax:"SVG",style:{position:"relative"}},t1={style:{"vertical-align":"-0.025ex"},xmlns:"http://www.w3.org/2000/svg",width:"1.294ex",height:"1.025ex",role:"img",focusable:"false",viewBox:"0 -442 572 453","aria-hidden":"true"},l1={class:"MathJax",jax:"SVG",style:{position:"relative"}},m1={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"12.96ex",height:"2.262ex",role:"img",focusable:"false",viewBox:"0 -750 5728.2 1000","aria-hidden":"true"},n1={class:"MathJax",jax:"SVG",style:{position:"relative"}},e1={style:{"vertical-align":"-0.464ex"},xmlns:"http://www.w3.org/2000/svg",width:"15.058ex",height:"2.351ex",role:"img",focusable:"false",viewBox:"0 -833.9 6655.4 1038.9","aria-hidden":"true"},s1={class:"MathJax",jax:"SVG",style:{position:"relative"}},o1={style:{"vertical-align":"-0.464ex"},xmlns:"http://www.w3.org/2000/svg",width:"1.109ex",height:"1.464ex",role:"img",focusable:"false",viewBox:"0 -442 490 647","aria-hidden":"true"},d1={class:"MathJax",jax:"SVG",style:{position:"relative"}},r1={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"6.85ex",height:"2.262ex",role:"img",focusable:"false",viewBox:"0 -750 3027.7 1000","aria-hidden":"true"},i1={class:"MathJax",jax:"SVG",style:{position:"relative"}},g1={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"11.028ex",height:"2.262ex",role:"img",focusable:"false",viewBox:"0 -750 4874.2 1000","aria-hidden":"true"},h1={class:"MathJax",jax:"SVG",style:{position:"relative"}},H1={style:{"vertical-align":"-0.025ex"},xmlns:"http://www.w3.org/2000/svg",width:"0.971ex",height:"1.595ex",role:"img",focusable:"false",viewBox:"0 -694 429 705","aria-hidden":"true"},p1={class:"MathJax",jax:"SVG",style:{position:"relative"}},L1={style:{"vertical-align":"-0.025ex"},xmlns:"http://www.w3.org/2000/svg",width:"1.294ex",height:"1.025ex",role:"img",focusable:"false",viewBox:"0 -442 572 453","aria-hidden":"true"},u1={class:"MathJax",jax:"SVG",style:{position:"relative"}},M1={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"15.934ex",height:"2.452ex",role:"img",focusable:"false",viewBox:"0 -833.9 7042.8 1083.9","aria-hidden":"true"},f1={class:"MathJax",jax:"SVG",style:{position:"relative"}},w1={style:{"vertical-align":"-0.439ex"},xmlns:"http://www.w3.org/2000/svg",width:"3.185ex",height:"1.439ex",role:"img",focusable:"false",viewBox:"0 -442 1407.7 636","aria-hidden":"true"};function V1(x1,T){return l(),t("div",null,[T[116]||(T[116]=m('

抛币协议


1. 使用单向函数

  1. Alice和Bob各自选择一个随机字符串,比如"ljngjkrjgnfdudiudd" 和 "gfdgdfjkherfsfsd"
  2. Alice随机生成一个抛硬币的结果,比如"tail"
  3. Bob把自己的随机字符串发送给Alice
  4. Alice把抛币结果和两个人的随机字符串合并成一个新的字符串,例如"tail ljngjkrjgnfdudiudd gfdgdfjkherfsfsd",并且把这个字符串的hash值"59dea408d43183a3937957e71a4bcacc616d9cbc"发送给Bob
  5. Alice问Bob: “你猜是head还是tail"?
  6. Bob猜一个结果,比如"head"
  7. Alice告诉告诉Bob他猜错了,并且出示完整的字符串

2. 使用满足交换律的加密算法

',5)),Q("ol",null,[Q("li",null,[T[4]||(T[4]=a("Alice和Bob通过别的协议协商出各自的RSA密钥对")),Q("mjx-container",s,[(l(),t("svg",o,T[0]||(T[0]=[m('',1)]))),T[1]||(T[1]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mo",{fence:"false",stretchy:"false"},"{"),Q("msub",null,[Q("mi",null,"e"),Q("mi",null,"a")]),Q("mo",null,","),Q("msub",null,[Q("mi",null,"d"),Q("mi",null,"a")]),Q("mo",null,","),Q("mi",null,"n"),Q("mo",{fence:"false",stretchy:"false"},"}"),Q("mo",null,","),Q("mo",{fence:"false",stretchy:"false"},"{"),Q("msub",null,[Q("mi",null,"e"),Q("mi",null,"b")]),Q("mi",null,"b"),Q("mo",null,","),Q("msub",null,[Q("mi",null,"d"),Q("mi",null,"b")]),Q("mo",null,","),Q("mi",null,"n"),Q("mo",{fence:"false",stretchy:"false"},"}")])],-1))]),T[5]||(T[5]=a(", 满足")),Q("mjx-container",d,[(l(),t("svg",r,T[2]||(T[2]=[m('',1)]))),T[3]||(T[3]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("msub",null,[Q("mi",null,"e"),Q("mi",null,"a")]),Q("msub",null,[Q("mi",null,"d"),Q("mi",null,"a")]),Q("mo",null,"≡"),Q("msub",null,[Q("mi",null,"e"),Q("mi",null,"b")]),Q("msub",null,[Q("mi",null,"d"),Q("mi",null,"b")]),Q("mo",null,"≡"),Q("mn",null,"1"),Q("mspace",{width:"0.444em"}),Q("mo",{stretchy:"false"},"("),Q("mi",null,"mod"),Q("mspace",{width:"0.333em"}),Q("mi",null,"ϕ"),Q("mo",{stretchy:"false"},"("),Q("mi",null,"p"),Q("mi",null,"q"),Q("mo",{stretchy:"false"},")"),Q("mo",{stretchy:"false"},")")])],-1))])]),Q("li",null,[T[10]||(T[10]=a("Alice生成两份消息")),Q("mjx-container",i,[(l(),t("svg",g,T[6]||(T[6]=[m('',1)]))),T[7]||(T[7]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("msub",null,[Q("mi",null,"M"),Q("mn",null,"1")])])],-1))]),T[11]||(T[11]=a("和")),Q("mjx-container",h,[(l(),t("svg",H,T[8]||(T[8]=[m('',1)]))),T[9]||(T[9]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("msub",null,[Q("mi",null,"M"),Q("mn",null,"2")])])],-1))]),T[12]||(T[12]=a(',一份表示"head",一份表示"tail",这些字符串还要包含双方协商好的特定字符串和随机字符串,以满足后期的验证'))]),Q("li",null,[T[15]||(T[15]=a("Alice使用自己的公钥加密这两份消息,得到")),Q("mjx-container",p,[(l(),t("svg",L,T[13]||(T[13]=[m('',1)]))),T[14]||(T[14]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("msub",null,[Q("mi",null,"E"),Q("mi",null,"a")]),Q("mo",{stretchy:"false"},"("),Q("msub",null,[Q("mi",null,"M"),Q("mn",null,"1")]),Q("mo",{stretchy:"false"},")"),Q("mo",null,","),Q("msub",null,[Q("mi",null,"E"),Q("mi",null,"a")]),Q("mo",{stretchy:"false"},"("),Q("msub",null,[Q("mi",null,"M"),Q("mn",null,"2")]),Q("mo",{stretchy:"false"},")")])],-1))]),T[16]||(T[16]=a(",并且以随机的顺序发给Bob"))]),Q("li",null,[T[21]||(T[21]=a("Bob无法识别消息的内容,随机选择其中的一个消息")),Q("mjx-container",u,[(l(),t("svg",M,T[17]||(T[17]=[Q("g",{stroke:"currentColor",fill:"currentColor","stroke-width":"0",transform:"scale(1,-1)"},[Q("g",{"data-mml-node":"math"},[Q("g",{"data-mml-node":"mi"},[Q("path",{"data-c":"1D440",d:"M289 629Q289 635 232 637Q208 637 201 638T194 648Q194 649 196 659Q197 662 198 666T199 671T201 676T203 679T207 681T212 683T220 683T232 684Q238 684 262 684T307 683Q386 683 398 683T414 678Q415 674 451 396L487 117L510 154Q534 190 574 254T662 394Q837 673 839 675Q840 676 842 678T846 681L852 683H948Q965 683 988 683T1017 684Q1051 684 1051 673Q1051 668 1048 656T1045 643Q1041 637 1008 637Q968 636 957 634T939 623Q936 618 867 340T797 59Q797 55 798 54T805 50T822 48T855 46H886Q892 37 892 35Q892 19 885 5Q880 0 869 0Q864 0 828 1T736 2Q675 2 644 2T609 1Q592 1 592 11Q592 13 594 25Q598 41 602 43T625 46Q652 46 685 49Q699 52 704 61Q706 65 742 207T813 490T848 631L654 322Q458 10 453 5Q451 4 449 3Q444 0 433 0Q418 0 415 7Q413 11 374 317L335 624L267 354Q200 88 200 79Q206 46 272 46H282Q288 41 289 37T286 19Q282 3 278 1Q274 0 267 0Q265 0 255 0T221 1T157 2Q127 2 95 1T58 0Q43 0 39 2T35 11Q35 13 38 25T43 40Q45 46 65 46Q135 46 154 86Q158 92 223 354T289 629Z"})])])],-1)]))),T[18]||(T[18]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"M")])],-1))]),T[22]||(T[22]=a(",并且用自己的公钥加密得到")),Q("mjx-container",f,[(l(),t("svg",w,T[19]||(T[19]=[m('',1)]))),T[20]||(T[20]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("msub",null,[Q("mi",null,"E"),Q("mi",null,"b")]),Q("mo",{stretchy:"false"},"("),Q("msub",null,[Q("mi",null,"E"),Q("mi",null,"a")]),Q("mo",{stretchy:"false"},"("),Q("mi",null,"M"),Q("mo",{stretchy:"false"},")"),Q("mo",{stretchy:"false"},")")])],-1))]),T[23]||(T[23]=a(",然后发送给Alice"))]),Q("li",null,[T[26]||(T[26]=a("Alice无法识别消息中的内容,用自己的私钥解密该消息,得到")),Q("mjx-container",V,[(l(),t("svg",x,T[24]||(T[24]=[m('',1)]))),T[25]||(T[25]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("msub",null,[Q("mi",null,"D"),Q("mi",null,"a")]),Q("mo",{stretchy:"false"},"("),Q("msub",null,[Q("mi",null,"E"),Q("mi",null,"b")]),Q("mo",{stretchy:"false"},"("),Q("msub",null,[Q("mi",null,"E"),Q("mi",null,"a")]),Q("mo",{stretchy:"false"},"("),Q("mi",null,"M"),Q("mo",{stretchy:"false"},")"),Q("mo",{stretchy:"false"},")"),Q("mo",{stretchy:"false"},")"),Q("mo",null,"="),Q("msub",null,[Q("mi",null,"E"),Q("mi",null,"b")]),Q("mo",{stretchy:"false"},"("),Q("mi",null,"M"),Q("mo",{stretchy:"false"},")")])],-1))]),T[27]||(T[27]=a(",然后发送回Bob"))]),Q("li",null,[T[30]||(T[30]=a("Bob用自己的私钥解密消息,得到")),Q("mjx-container",Z,[(l(),t("svg",c,T[28]||(T[28]=[m('',1)]))),T[29]||(T[29]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("msub",null,[Q("mi",null,"D"),Q("mi",null,"b")]),Q("mo",{stretchy:"false"},"("),Q("msub",null,[Q("mi",null,"E"),Q("mi",null,"b")]),Q("mo",{stretchy:"false"},"("),Q("mi",null,"M"),Q("mo",{stretchy:"false"},")"),Q("mo",{stretchy:"false"},")"),Q("mo",{stretchy:"false"},")"),Q("mo",null,"="),Q("mi",null,"M")])],-1))]),T[31]||(T[31]=a(",于是Bob得到了抛币的结果并发送给Alice"))]),T[32]||(T[32]=Q("li",null,"双方交换各自的密钥对,以验证过程双方有没有欺诈",-1))]),T[117]||(T[117]=Q("h2",{id:"_3-使用二次剩余",tabindex:"-1"},[Q("a",{class:"header-anchor",href:"#_3-使用二次剩余"},[Q("span",null,"3. 使用二次剩余")])],-1)),Q("ol",null,[Q("li",null,[T[39]||(T[39]=a("Alice选择两个质数")),Q("mjx-container",v,[(l(),t("svg",y,T[33]||(T[33]=[m('',1)]))),T[34]||(T[34]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"p"),Q("mo",null,","),Q("mi",null,"q")])],-1))]),T[40]||(T[40]=a(",计算")),Q("mjx-container",b,[(l(),t("svg",D,T[35]||(T[35]=[m('',1)]))),T[36]||(T[36]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"n"),Q("mo",null,"="),Q("mi",null,"q"),Q("mi",null,"p")])],-1))]),T[41]||(T[41]=a(",然后将")),Q("mjx-container",j,[(l(),t("svg",C,T[37]||(T[37]=[Q("g",{stroke:"currentColor",fill:"currentColor","stroke-width":"0",transform:"scale(1,-1)"},[Q("g",{"data-mml-node":"math"},[Q("g",{"data-mml-node":"mi"},[Q("path",{"data-c":"1D45B",d:"M21 287Q22 293 24 303T36 341T56 388T89 425T135 442Q171 442 195 424T225 390T231 369Q231 367 232 367L243 378Q304 442 382 442Q436 442 469 415T503 336T465 179T427 52Q427 26 444 26Q450 26 453 27Q482 32 505 65T540 145Q542 153 560 153Q580 153 580 145Q580 144 576 130Q568 101 554 73T508 17T439 -10Q392 -10 371 17T350 73Q350 92 386 193T423 345Q423 404 379 404H374Q288 404 229 303L222 291L189 157Q156 26 151 16Q138 -11 108 -11Q95 -11 87 -5T76 7T74 17Q74 30 112 180T152 343Q153 348 153 366Q153 405 129 405Q91 405 66 305Q60 285 60 284Q58 278 41 278H27Q21 284 21 287Z"})])])],-1)]))),T[38]||(T[38]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"n")])],-1))]),T[42]||(T[42]=a("发送给Bob"))]),Q("li",null,[T[49]||(T[49]=a("Bob随机一个数字")),Q("mjx-container",B,[(l(),t("svg",k,T[43]||(T[43]=[m('',1)]))),T[44]||(T[44]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"x"),Q("mo",null,"<"),Q("mi",null,"n"),Q("mrow",{"data-mjx-texclass":"ORD"},[Q("mo",null,"/")]),Q("mn",null,"2")])],-1))]),T[50]||(T[50]=a(",计算")),Q("mjx-container",S,[(l(),t("svg",J,T[45]||(T[45]=[m('',1)]))),T[46]||(T[46]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"y"),Q("mo",null,"="),Q("msup",null,[Q("mi",null,"x"),Q("mn",null,"2")]),Q("mspace",{width:"0.667em"}),Q("mi",null,"mod"),Q("mstyle",{scriptlevel:"0"},[Q("mspace",{width:"0.167em"})]),Q("mstyle",{scriptlevel:"0"},[Q("mspace",{width:"0.167em"})]),Q("mi",null,"n")])],-1))]),T[51]||(T[51]=a(",并发送")),Q("mjx-container",G,[(l(),t("svg",A,T[47]||(T[47]=[Q("g",{stroke:"currentColor",fill:"currentColor","stroke-width":"0",transform:"scale(1,-1)"},[Q("g",{"data-mml-node":"math"},[Q("g",{"data-mml-node":"mi"},[Q("path",{"data-c":"1D466",d:"M21 287Q21 301 36 335T84 406T158 442Q199 442 224 419T250 355Q248 336 247 334Q247 331 231 288T198 191T182 105Q182 62 196 45T238 27Q261 27 281 38T312 61T339 94Q339 95 344 114T358 173T377 247Q415 397 419 404Q432 431 462 431Q475 431 483 424T494 412T496 403Q496 390 447 193T391 -23Q363 -106 294 -155T156 -205Q111 -205 77 -183T43 -117Q43 -95 50 -80T69 -58T89 -48T106 -45Q150 -45 150 -87Q150 -107 138 -122T115 -142T102 -147L99 -148Q101 -153 118 -160T152 -167H160Q177 -167 186 -165Q219 -156 247 -127T290 -65T313 -9T321 21L315 17Q309 13 296 6T270 -6Q250 -11 231 -11Q185 -11 150 11T104 82Q103 89 103 113Q103 170 138 262T173 379Q173 380 173 381Q173 390 173 393T169 400T158 404H154Q131 404 112 385T82 344T65 302T57 280Q55 278 41 278H27Q21 284 21 287Z"})])])],-1)]))),T[48]||(T[48]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"y")])],-1))]),T[52]||(T[52]=a("给Alice"))]),Q("li",null,[T[57]||(T[57]=a("Alice求解同余方程")),Q("mjx-container",E,[(l(),t("svg",q,T[53]||(T[53]=[m('',1)]))),T[54]||(T[54]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("msup",null,[Q("mi",null,"x"),Q("mn",null,"2")]),Q("mo",null,"≡"),Q("mi",null,"y"),Q("mspace",{width:"0.444em"}),Q("mo",{stretchy:"false"},"("),Q("mi",null,"mod"),Q("mspace",{width:"0.333em"}),Q("mi",null,"p"),Q("mi",null,"q"),Q("mo",{stretchy:"false"},")")])],-1))]),T[58]||(T[58]=a(",得到两对解,分别是")),Q("mjx-container",F,[(l(),t("svg",N,T[55]||(T[55]=[m('',1)]))),T[56]||(T[56]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mo",null,"±"),Q("msub",null,[Q("mi",null,"x"),Q("mn",null,"1")]),Q("mo",null,","),Q("mo",null,"±"),Q("msub",null,[Q("mi",null,"x"),Q("mn",null,"2")])])],-1))])]),Q("li",null,[T[61]||(T[61]=a("Alice猜测Bob所随机的数字属于哪组解,并发送该组解")),Q("mjx-container",O,[(l(),t("svg",R,T[59]||(T[59]=[m('',1)]))),T[60]||(T[60]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mo",null,"±"),Q("msup",null,[Q("mi",null,"x"),Q("mo",{"data-mjx-alternate":"1"},"′")])])],-1))]),T[62]||(T[62]=a("给Bob"))]),Q("li",null,[T[67]||(T[67]=a("Bob根据结果判断,如果")),Q("mjx-container",P,[(l(),t("svg",z,T[63]||(T[63]=[m('',1)]))),T[64]||(T[64]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"x"),Q("mo",null,"="),Q("msup",null,[Q("mi",null,"x"),Q("mo",{"data-mjx-alternate":"1"},"′")])])],-1))]),T[68]||(T[68]=a("或者")),Q("mjx-container",X,[(l(),t("svg",I,T[65]||(T[65]=[m('',1)]))),T[66]||(T[66]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"x"),Q("mo",null,"="),Q("mi",null,"n"),Q("mo",null,"−"),Q("msup",null,[Q("mi",null,"x"),Q("mo",{"data-mjx-alternate":"1"},"′")])])],-1))]),T[69]||(T[69]=a(",表示Alice猜对了,否则就是猜错了"))]),Q("li",null,[T[72]||(T[72]=a("Bob把结果告诉Alice,并出示")),Q("mjx-container",K,[(l(),t("svg",U,T[70]||(T[70]=[Q("g",{stroke:"currentColor",fill:"currentColor","stroke-width":"0",transform:"scale(1,-1)"},[Q("g",{"data-mml-node":"math"},[Q("g",{"data-mml-node":"mi"},[Q("path",{"data-c":"1D465",d:"M52 289Q59 331 106 386T222 442Q257 442 286 424T329 379Q371 442 430 442Q467 442 494 420T522 361Q522 332 508 314T481 292T458 288Q439 288 427 299T415 328Q415 374 465 391Q454 404 425 404Q412 404 406 402Q368 386 350 336Q290 115 290 78Q290 50 306 38T341 26Q378 26 414 59T463 140Q466 150 469 151T485 153H489Q504 153 504 145Q504 144 502 134Q486 77 440 33T333 -11Q263 -11 227 52Q186 -10 133 -10H127Q78 -10 57 16T35 71Q35 103 54 123T99 143Q142 143 142 101Q142 81 130 66T107 46T94 41L91 40Q91 39 97 36T113 29T132 26Q168 26 194 71Q203 87 217 139T245 247T261 313Q266 340 266 352Q266 380 251 392T217 404Q177 404 142 372T93 290Q91 281 88 280T72 278H58Q52 284 52 289Z"})])])],-1)]))),T[71]||(T[71]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"x")])],-1))])]),Q("li",null,[T[75]||(T[75]=a("Alice把")),Q("mjx-container",W,[(l(),t("svg",Y,T[73]||(T[73]=[m('',1)]))),T[74]||(T[74]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"p"),Q("mo",null,","),Q("mi",null,"q")])],-1))]),T[76]||(T[76]=a("告诉Bob验算"))])]),T[118]||(T[118]=Q("h2",{id:"_4-使用雅可比符号",tabindex:"-1"},[Q("a",{class:"header-anchor",href:"#_4-使用雅可比符号"},[Q("span",null,"4. 使用雅可比符号")])],-1)),Q("ol",null,[Q("li",null,[T[81]||(T[81]=a("Bob随机选择两个质数,满足")),Q("mjx-container",$,[(l(),t("svg",_,T[77]||(T[77]=[m('',1)]))),T[78]||(T[78]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"p"),Q("mo",null,"≡"),Q("mn",null,"3"),Q("mspace",{width:"0.444em"}),Q("mo",{stretchy:"false"},"("),Q("mi",null,"mod"),Q("mspace",{width:"0.333em"}),Q("mn",null,"4"),Q("mo",{stretchy:"false"},")"),Q("mo",null,","),Q("mi",null,"q"),Q("mo",null,"≡"),Q("mn",null,"3"),Q("mspace",{width:"0.444em"}),Q("mo",{stretchy:"false"},"("),Q("mi",null,"mod"),Q("mspace",{width:"0.333em"}),Q("mn",null,"4"),Q("mo",{stretchy:"false"},")")])],-1))]),T[82]||(T[82]=a(", 计算")),Q("mjx-container",Q1,[(l(),t("svg",T1,T[79]||(T[79]=[m('',1)]))),T[80]||(T[80]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"n"),Q("mo",null,"="),Q("mi",null,"p"),Q("mi",null,"q")])],-1))]),T[83]||(T[83]=a("发送给Alice"))]),Q("li",null,[T[92]||(T[92]=a("Alice随机选择一个数字")),Q("mjx-container",a1,[(l(),t("svg",t1,T[84]||(T[84]=[Q("g",{stroke:"currentColor",fill:"currentColor","stroke-width":"0",transform:"scale(1,-1)"},[Q("g",{"data-mml-node":"math"},[Q("g",{"data-mml-node":"mi"},[Q("path",{"data-c":"1D465",d:"M52 289Q59 331 106 386T222 442Q257 442 286 424T329 379Q371 442 430 442Q467 442 494 420T522 361Q522 332 508 314T481 292T458 288Q439 288 427 299T415 328Q415 374 465 391Q454 404 425 404Q412 404 406 402Q368 386 350 336Q290 115 290 78Q290 50 306 38T341 26Q378 26 414 59T463 140Q466 150 469 151T485 153H489Q504 153 504 145Q504 144 502 134Q486 77 440 33T333 -11Q263 -11 227 52Q186 -10 133 -10H127Q78 -10 57 16T35 71Q35 103 54 123T99 143Q142 143 142 101Q142 81 130 66T107 46T94 41L91 40Q91 39 97 36T113 29T132 26Q168 26 194 71Q203 87 217 139T245 247T261 313Q266 340 266 352Q266 380 251 392T217 404Q177 404 142 372T93 290Q91 281 88 280T72 278H58Q52 284 52 289Z"})])])],-1)]))),T[85]||(T[85]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"x")])],-1))]),T[93]||(T[93]=a(", 满足")),Q("mjx-container",l1,[(l(),t("svg",m1,T[86]||(T[86]=[m('',1)]))),T[87]||(T[87]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mo",{"data-mjx-texclass":"OP",movablelimits:"true"},"gcd"),Q("mo",{stretchy:"false"},"("),Q("mi",null,"x"),Q("mo",null,","),Q("mi",null,"n"),Q("mo",{stretchy:"false"},")"),Q("mo",null,"="),Q("mn",null,"1")])],-1))]),T[94]||(T[94]=a(", 计算")),Q("mjx-container",n1,[(l(),t("svg",e1,T[88]||(T[88]=[m('',1)]))),T[89]||(T[89]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"y"),Q("mo",null,"="),Q("msup",null,[Q("mi",null,"x"),Q("mn",null,"2")]),Q("mspace",{width:"0.667em"}),Q("mi",null,"mod"),Q("mstyle",{scriptlevel:"0"},[Q("mspace",{width:"0.167em"})]),Q("mstyle",{scriptlevel:"0"},[Q("mspace",{width:"0.167em"})]),Q("mi",null,"n")])],-1))]),T[95]||(T[95]=a(",把")),Q("mjx-container",s1,[(l(),t("svg",o1,T[90]||(T[90]=[Q("g",{stroke:"currentColor",fill:"currentColor","stroke-width":"0",transform:"scale(1,-1)"},[Q("g",{"data-mml-node":"math"},[Q("g",{"data-mml-node":"mi"},[Q("path",{"data-c":"1D466",d:"M21 287Q21 301 36 335T84 406T158 442Q199 442 224 419T250 355Q248 336 247 334Q247 331 231 288T198 191T182 105Q182 62 196 45T238 27Q261 27 281 38T312 61T339 94Q339 95 344 114T358 173T377 247Q415 397 419 404Q432 431 462 431Q475 431 483 424T494 412T496 403Q496 390 447 193T391 -23Q363 -106 294 -155T156 -205Q111 -205 77 -183T43 -117Q43 -95 50 -80T69 -58T89 -48T106 -45Q150 -45 150 -87Q150 -107 138 -122T115 -142T102 -147L99 -148Q101 -153 118 -160T152 -167H160Q177 -167 186 -165Q219 -156 247 -127T290 -65T313 -9T321 21L315 17Q309 13 296 6T270 -6Q250 -11 231 -11Q185 -11 150 11T104 82Q103 89 103 113Q103 170 138 262T173 379Q173 380 173 381Q173 390 173 393T169 400T158 404H154Q131 404 112 385T82 344T65 302T57 280Q55 278 41 278H27Q21 284 21 287Z"})])])],-1)]))),T[91]||(T[91]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"y")])],-1))]),T[96]||(T[96]=a("发送给Bob"))]),Q("li",null,[T[103]||(T[103]=a("Bob猜测")),Q("mjx-container",d1,[(l(),t("svg",r1,T[97]||(T[97]=[m('',1)]))),T[98]||(T[98]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"J"),Q("mo",{stretchy:"false"},"("),Q("mi",null,"x"),Q("mo",null,","),Q("mi",null,"n"),Q("mo",{stretchy:"false"},")")])],-1))]),T[104]||(T[104]=a("的数值")),Q("mjx-container",i1,[(l(),t("svg",g1,T[99]||(T[99]=[m('',1)]))),T[100]||(T[100]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"b"),Q("mo",null,"∈"),Q("mo",{fence:"false",stretchy:"false"},"{"),Q("mo",null,"−"),Q("mn",null,"1"),Q("mo",null,","),Q("mn",null,"1"),Q("mo",{fence:"false",stretchy:"false"},"}")])],-1))]),T[105]||(T[105]=a(",并且把")),Q("mjx-container",h1,[(l(),t("svg",H1,T[101]||(T[101]=[Q("g",{stroke:"currentColor",fill:"currentColor","stroke-width":"0",transform:"scale(1,-1)"},[Q("g",{"data-mml-node":"math"},[Q("g",{"data-mml-node":"mi"},[Q("path",{"data-c":"1D44F",d:"M73 647Q73 657 77 670T89 683Q90 683 161 688T234 694Q246 694 246 685T212 542Q204 508 195 472T180 418L176 399Q176 396 182 402Q231 442 283 442Q345 442 383 396T422 280Q422 169 343 79T173 -11Q123 -11 82 27T40 150V159Q40 180 48 217T97 414Q147 611 147 623T109 637Q104 637 101 637H96Q86 637 83 637T76 640T73 647ZM336 325V331Q336 405 275 405Q258 405 240 397T207 376T181 352T163 330L157 322L136 236Q114 150 114 114Q114 66 138 42Q154 26 178 26Q211 26 245 58Q270 81 285 114T318 219Q336 291 336 325Z"})])])],-1)]))),T[102]||(T[102]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"b")])],-1))]),T[106]||(T[106]=a("发送给Alice"))]),Q("li",null,[T[109]||(T[109]=a("Alice向Bob出示")),Q("mjx-container",p1,[(l(),t("svg",L1,T[107]||(T[107]=[Q("g",{stroke:"currentColor",fill:"currentColor","stroke-width":"0",transform:"scale(1,-1)"},[Q("g",{"data-mml-node":"math"},[Q("g",{"data-mml-node":"mi"},[Q("path",{"data-c":"1D465",d:"M52 289Q59 331 106 386T222 442Q257 442 286 424T329 379Q371 442 430 442Q467 442 494 420T522 361Q522 332 508 314T481 292T458 288Q439 288 427 299T415 328Q415 374 465 391Q454 404 425 404Q412 404 406 402Q368 386 350 336Q290 115 290 78Q290 50 306 38T341 26Q378 26 414 59T463 140Q466 150 469 151T485 153H489Q504 153 504 145Q504 144 502 134Q486 77 440 33T333 -11Q263 -11 227 52Q186 -10 133 -10H127Q78 -10 57 16T35 71Q35 103 54 123T99 143Q142 143 142 101Q142 81 130 66T107 46T94 41L91 40Q91 39 97 36T113 29T132 26Q168 26 194 71Q203 87 217 139T245 247T261 313Q266 340 266 352Q266 380 251 392T217 404Q177 404 142 372T93 290Q91 281 88 280T72 278H58Q52 284 52 289Z"})])])],-1)]))),T[108]||(T[108]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"x")])],-1))])]),Q("li",null,[T[114]||(T[114]=a("Bob验证")),Q("mjx-container",u1,[(l(),t("svg",M1,T[110]||(T[110]=[m('',1)]))),T[111]||(T[111]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"y"),Q("mo",null,"≡"),Q("msup",null,[Q("mi",null,"x"),Q("mn",null,"2")]),Q("mspace",{width:"0.444em"}),Q("mo",{stretchy:"false"},"("),Q("mi",null,"mod"),Q("mspace",{width:"0.333em"}),Q("mi",null,"n"),Q("mo",{stretchy:"false"},")")])],-1))]),T[115]||(T[115]=a(",并向Alice出示")),Q("mjx-container",f1,[(l(),t("svg",w1,T[112]||(T[112]=[m('',1)]))),T[113]||(T[113]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"p"),Q("mo",null,","),Q("mi",null,"q")])],-1))])])])])}const c1=n(e,[["render",V1],["__file","flip_coin.html.vue"]]),v1=JSON.parse('{"path":"/note/cryptography/flip_coin.html","title":"抛币协议","lang":"zh-CN","frontmatter":{},"headers":[{"level":2,"title":"1. 使用单向函数","slug":"_1-使用单向函数","link":"#_1-使用单向函数","children":[]},{"level":2,"title":"2. 使用满足交换律的加密算法","slug":"_2-使用满足交换律的加密算法","link":"#_2-使用满足交换律的加密算法","children":[]},{"level":2,"title":"3. 使用二次剩余","slug":"_3-使用二次剩余","link":"#_3-使用二次剩余","children":[]},{"level":2,"title":"4. 使用雅可比符号","slug":"_4-使用雅可比符号","link":"#_4-使用雅可比符号","children":[]}],"git":{},"filePathRelative":"note/cryptography/flip_coin.md"}');export{c1 as comp,v1 as data};