import{_ as n,c as t,a as m,b as Q,d as a,o as l}from"./app-D1UhKcG3.js";const e="/images/2018/04/vdice_01.png",s="/images/2018/04/vdice_02.png",r="/images/2018/04/vdice_03.png",o={},d={class:"MathJax",jax:"SVG",style:{position:"relative"}},i={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"},g={class:"MathJax",jax:"SVG",style:{position:"relative"}},h={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"},H={class:"MathJax",jax:"SVG",style:{position:"relative"}},p={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"},V={class:"MathJax",jax:"SVG",style:{position:"relative"}},f={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"},x={class:"MathJax",jax:"SVG",style:{position:"relative"}},L={style:{"vertical-align":"-0.464ex"},xmlns:"http://www.w3.org/2000/svg",width:"13.296ex",height:"2.351ex",role:"img",focusable:"false",viewBox:"0 -833.9 5876.7 1038.9","aria-hidden":"true"},u={class:"MathJax",jax:"SVG",style:{position:"relative"}},M={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"},w={class:"MathJax",jax:"SVG",style:{position:"relative"}},c={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"},Z={class:"MathJax",jax:"SVG",style:{position:"relative"}},v={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"6.298ex",height:"2.262ex",role:"img",focusable:"false",viewBox:"0 -750 2783.6 1000","aria-hidden":"true"},y={class:"MathJax",jax:"SVG",style:{position:"relative"}},j={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"},b={class:"MathJax",jax:"SVG",style:{position:"relative"}},D={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"},k={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"}},S={style:{"vertical-align":"-0.439ex"},xmlns:"http://www.w3.org/2000/svg",width:"1.041ex",height:"1.439ex",role:"img",focusable:"false",viewBox:"0 -442 460 636","aria-hidden":"true"},E={class:"MathJax",jax:"SVG",style:{position:"relative"}},J={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"},G={class:"MathJax",jax:"SVG",style:{position:"relative"}},O={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"15.866ex",height:"2.452ex",role:"img",focusable:"false",viewBox:"0 -833.9 7012.8 1083.9","aria-hidden":"true"},R={class:"MathJax",jax:"SVG",style:{position:"relative"}},N={style:{"vertical-align":"-0.439ex"},xmlns:"http://www.w3.org/2000/svg",width:"1.041ex",height:"1.439ex",role:"img",focusable:"false",viewBox:"0 -442 460 636","aria-hidden":"true"},A={class:"MathJax",jax:"SVG",style:{position:"relative"}},P={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"},q={class:"MathJax",jax:"SVG",style:{position:"relative"}},z={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"15.567ex",height:"2.452ex",role:"img",focusable:"false",viewBox:"0 -833.9 6880.8 1083.9","aria-hidden":"true"},F={class:"MathJax",jax:"SVG",style:{position:"relative"}},I={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"15.73ex",height:"2.452ex",role:"img",focusable:"false",viewBox:"0 -833.9 6952.8 1083.9","aria-hidden":"true"},X={class:"MathJax",jax:"SVG",style:{position:"relative"}},Y={style:{"vertical-align":"-0.439ex"},xmlns:"http://www.w3.org/2000/svg",width:"1.138ex",height:"1.439ex",role:"img",focusable:"false",viewBox:"0 -442 503 636","aria-hidden":"true"},K={class:"MathJax",jax:"SVG",style:{position:"relative"}},W={style:{"vertical-align":"-0.023ex"},xmlns:"http://www.w3.org/2000/svg",width:"1.197ex",height:"1.02ex",role:"img",focusable:"false",viewBox:"0 -441 529 451","aria-hidden":"true"},U={class:"MathJax",jax:"SVG",display:"true",width:"full",style:{"min-width":"43.092ex",position:"relative"}},$={style:{"vertical-align":"-3.054ex","min-width":"43.092ex"},xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"7.24ex",role:"img",focusable:"false","aria-hidden":"true"},_={class:"MathJax",jax:"SVG",style:{position:"relative"}},Q1={style:{"vertical-align":"-1.469ex"},xmlns:"http://www.w3.org/2000/svg",width:"4.543ex",height:"4.07ex",role:"img",focusable:"false",viewBox:"0 -1149.5 2008.1 1799","aria-hidden":"true"},T1={class:"MathJax",jax:"SVG",style:{position:"relative"}},a1={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"5.981ex",height:"2.262ex",role:"img",focusable:"false",viewBox:"0 -750 2643.6 1000","aria-hidden":"true"},t1={class:"MathJax",jax:"SVG",display:"true",width:"full",style:{"min-width":"35.586ex",position:"relative"}},l1={style:{"vertical-align":"-2.148ex","min-width":"35.586ex"},xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"5.428ex",role:"img",focusable:"false","aria-hidden":"true"},m1={class:"MathJax",jax:"SVG",display:"true",style:{position:"relative"}},n1={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"33.702ex",height:"2.7ex",role:"img",focusable:"false",viewBox:"0 -943.3 14896.4 1193.3","aria-hidden":"true"},e1={class:"MathJax",jax:"SVG",display:"true",style:{position:"relative"}},s1={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"37.725ex",height:"2.7ex",role:"img",focusable:"false",viewBox:"0 -943.3 16674.4 1193.3","aria-hidden":"true"},r1={class:"MathJax",jax:"SVG",style:{position:"relative"}},o1={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"20.25ex",height:"2.262ex",role:"img",focusable:"false",viewBox:"0 -750 8950.7 1000","aria-hidden":"true"},d1={class:"MathJax",jax:"SVG",style:{position:"relative"}},i1={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"},g1={class:"MathJax",jax:"SVG",style:{position:"relative"}},h1={style:{"vertical-align":"-0.798ex"},xmlns:"http://www.w3.org/2000/svg",width:"4.028ex",height:"2.72ex",role:"img",focusable:"false",viewBox:"0 -849.5 1780.3 1202.3","aria-hidden":"true"},H1={class:"MathJax",jax:"SVG",style:{position:"relative"}},p1={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"6.2ex",height:"2.262ex",role:"img",focusable:"false",viewBox:"0 -750 2740.6 1000","aria-hidden":"true"},V1={class:"MathJax",jax:"SVG",style:{position:"relative"}},f1={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"},x1={class:"MathJax",jax:"SVG",style:{position:"relative"}},L1={style:{"vertical-align":"-0.439ex"},xmlns:"http://www.w3.org/2000/svg",width:"14.191ex",height:"1.758ex",role:"img",focusable:"false",viewBox:"0 -583 6272.4 777","aria-hidden":"true"},u1={class:"MathJax",jax:"SVG",display:"true",width:"full",style:{"min-width":"40.645ex",position:"relative"}},M1={style:{"vertical-align":"-2.148ex","min-width":"40.645ex"},xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"5.428ex",role:"img",focusable:"false","aria-hidden":"true"},w1={class:"MathJax",jax:"SVG",display:"true",style:{position:"relative"}},c1={style:{"vertical-align":"-2.148ex"},xmlns:"http://www.w3.org/2000/svg",width:"40.759ex",height:"5.428ex",role:"img",focusable:"false",viewBox:"0 -1449.5 18015.3 2399","aria-hidden":"true"},Z1={class:"MathJax",jax:"SVG",style:{position:"relative"}},v1={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"11.062ex",height:"2.262ex",role:"img",focusable:"false",viewBox:"0 -750 4889.6 1000","aria-hidden":"true"},y1={class:"MathJax",jax:"SVG",style:{position:"relative"}},j1={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"},b1={class:"MathJax",jax:"SVG",style:{position:"relative"}},D1={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"},k1={class:"MathJax",jax:"SVG",style:{position:"relative"}},C1={style:{"vertical-align":"-0.439ex"},xmlns:"http://www.w3.org/2000/svg",width:"2.179ex",height:"1.439ex",role:"img",focusable:"false",viewBox:"0 -442 963 636","aria-hidden":"true"},B1={class:"MathJax",jax:"SVG",style:{position:"relative"}},S1={style:{"vertical-align":"-0.023ex"},xmlns:"http://www.w3.org/2000/svg",width:"1.197ex",height:"1.02ex",role:"img",focusable:"false",viewBox:"0 -441 529 451","aria-hidden":"true"},E1={class:"MathJax",jax:"SVG",style:{position:"relative"}},J1={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"},G1={class:"MathJax",jax:"SVG",display:"true",style:{position:"relative"}},O1={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"17.28ex",height:"2.565ex",role:"img",focusable:"false",viewBox:"0 -883.9 7637.8 1133.9","aria-hidden":"true"},R1={class:"MathJax",jax:"SVG",style:{position:"relative"}},N1={style:{"vertical-align":"-0.439ex"},xmlns:"http://www.w3.org/2000/svg",width:"2.179ex",height:"1.439ex",role:"img",focusable:"false",viewBox:"0 -442 963 636","aria-hidden":"true"},A1={class:"MathJax",jax:"SVG",style:{position:"relative"}},P1={style:{"vertical-align":"-0.439ex"},xmlns:"http://www.w3.org/2000/svg",width:"2.179ex",height:"1.439ex",role:"img",focusable:"false",viewBox:"0 -442 963 636","aria-hidden":"true"},q1={class:"MathJax",jax:"SVG",style:{position:"relative"}},z1={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"},F1={class:"MathJax",jax:"SVG",style:{position:"relative"}},I1={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"},X1={class:"MathJax",jax:"SVG",style:{position:"relative"}},Y1={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"10.446ex",height:"2.262ex",role:"img",focusable:"false",viewBox:"0 -750 4617.1 1000","aria-hidden":"true"},K1={class:"MathJax",jax:"SVG",style:{position:"relative"}},W1={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"12.206ex",height:"2.262ex",role:"img",focusable:"false",viewBox:"0 -750 5395.1 1000","aria-hidden":"true"},U1={class:"MathJax",jax:"SVG",style:{position:"relative"}},$1={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"16.861ex",height:"2.452ex",role:"img",focusable:"false",viewBox:"0 -833.9 7452.8 1083.9","aria-hidden":"true"},_1={class:"MathJax",jax:"SVG",style:{position:"relative"}},Q2={style:{"vertical-align":"-0.464ex"},xmlns:"http://www.w3.org/2000/svg",width:"9.963ex",height:"1.464ex",role:"img",focusable:"false",viewBox:"0 -442 4403.7 647","aria-hidden":"true"},T2={class:"MathJax",jax:"SVG",style:{position:"relative"}},a2={style:{"vertical-align":"-0.464ex"},xmlns:"http://www.w3.org/2000/svg",width:"5.772ex",height:"1.464ex",role:"img",focusable:"false",viewBox:"0 -442 2551.3 647","aria-hidden":"true"},t2={class:"MathJax",jax:"SVG",style:{position:"relative"}},l2={style:{"vertical-align":"-0.464ex"},xmlns:"http://www.w3.org/2000/svg",width:"7.663ex",height:"1.464ex",role:"img",focusable:"false",viewBox:"0 -442 3387 647","aria-hidden":"true"},m2={class:"MathJax",jax:"SVG",style:{position:"relative"}},n2={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"},e2={class:"MathJax",jax:"SVG",style:{position:"relative"}},s2={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"},r2={class:"MathJax",jax:"SVG",style:{position:"relative"}},o2={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"},d2={class:"MathJax",jax:"SVG",display:"true",style:{position:"relative"}},i2={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"18.365ex",height:"2.565ex",role:"img",focusable:"false",viewBox:"0 -883.9 8117.3 1133.9","aria-hidden":"true"},g2={class:"MathJax",jax:"SVG",display:"true",style:{position:"relative"}},h2={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"17.588ex",height:"2.262ex",role:"img",focusable:"false",viewBox:"0 -750 7773.8 1000","aria-hidden":"true"},H2={class:"MathJax",jax:"SVG",display:"true",style:{position:"relative"}},p2={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"43.458ex",height:"2.565ex",role:"img",focusable:"false",viewBox:"0 -883.9 19208.4 1133.9","aria-hidden":"true"},V2={class:"MathJax",jax:"SVG",style:{position:"relative"}},f2={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"};function x2(L2,T){return l(),t("div",null,[T[191]||(T[191]=m('

从抛币协议到智能合约(一)

最近区块链非常火,也有人在讨论游戏和区块链的结合,就目前来看,已有的区块链游戏无非就是两种,一种就是类似于CryptoKitties这样的虚拟资产游戏,还有就是博彩类的游戏,比如中本聪筛子,vDice等。

这是我当初花了300刀买的一只CryptoKitties,编号448412

严格来说,这些都不算是真正的游戏,在我看来,区块链游戏起码要做到真正的去中心化,能够实现玩家和玩家之间的互动,并且能提供玩家最基本的游戏乐趣才行。而目前所谓的区块链游戏还远远无法满足这几点,而且现在的区块链被笼罩在非常不好的资本炒作氛围中,所谓的区块链创业大部分都是挂羊头卖狗肉而已。 从技术上讲,游戏的去中心化并不是一件新鲜事,比如加密领域的“抛币协议”可以算是这方面的老祖宗了。早在1981年,数学家Manuel Blum就曾经发表了一篇著名的论文《Coin Flipping by Telephone: A Protocol for Solving Impossible Problems.》,在开篇就提出一个有趣的情景:

简单的描述就是两个人想通过抛硬币来决定解决他们之间的分歧,那么如何通过电话或者互联网来实现这个行为呢?很显然让其中一个人来随机是不行的,因为他们互不信任,两个人合作呢?比如说双方各自从0和1之间随机一个值,然后把两个值异或作为最终的结果?也不行,比如说Alice随机出0或者1,她把这个数告诉Bob,那么Bob就有机会根据Alice随机到的值操纵最后结果。所以想得到真正公平的结果,抛币协议必须能够满足“抛币入井”的特性,如同把硬币扔进井中,双方只可以去观看而不能改变结果。
一种简单的方法是利用单向函数,比如首先让Alice准备一个随机字符串,其中包含”head”或者”tail”作为抛币结果, 然后把这个字符串的hash值给Bob,让Bob猜是head还是tail,最后Alice把原始的字符串公布以验证。这个协议利用了hash函数是单向函数的特性,由于Bob只收到了hash值,他无法判断原始字符串,所以无法作弊,而Alice如果想抵赖,就需要能够操纵这个hash函数,重新构造出一个字符串使其hash值和发给Bob的那个一摸一样,这也是不可能的(或者说很困难的),在WikiPedia给出了一种这个协议的具体实现。

但Blum给出的协议并不是这样,原因是使用hash函数并不“严肃”,因为很难对其进行严格的安全性分析,尽管Bob无法从hash值反推回原来的字符串,但他很可能发现一些蛛丝马迹,而且靠其中一方直接随机出抛币结果也不公平,因为这需要依赖很高质量且双方都信任的随机函数,Blum的抛币协议可以简单的描述为下面的过程:

',7)),Q("ol",null,[Q("li",null,[T[2]||(T[2]=a("首先Bob准备一个Blum整数")),Q("mjx-container",d,[(l(),t("svg",i,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("mi",null,"n"),Q("mo",null,"="),Q("mi",null,"p"),Q("mi",null,"q")])],-1))]),T[3]||(T[3]=a(",并且把n发送给Alice"))]),Q("li",null,[T[14]||(T[14]=a("Alice随机一个小于")),Q("mjx-container",g,[(l(),t("svg",h,T[4]||(T[4]=[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[5]||(T[5]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"n")])],-1))]),T[15]||(T[15]=a("且和")),Q("mjx-container",H,[(l(),t("svg",p,T[6]||(T[6]=[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[7]||(T[7]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"n")])],-1))]),T[16]||(T[16]=a("互质的数")),Q("mjx-container",V,[(l(),t("svg",f,T[8]||(T[8]=[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[9]||(T[9]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"x")])],-1))]),T[17]||(T[17]=a(",计算")),Q("mjx-container",x,[(l(),t("svg",L,T[10]||(T[10]=[m('',1)]))),T[11]||(T[11]=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("mo",{lspace:"thickmathspace",rspace:"thickmathspace"},"mod"),Q("mi",null,"n")])],-1))]),T[18]||(T[18]=a(",然后把")),Q("mjx-container",u,[(l(),t("svg",M,T[12]||(T[12]=[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[13]||(T[13]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"y")])],-1))]),T[19]||(T[19]=a("发送给Bob"))]),Q("li",null,[T[24]||(T[24]=a("Bob猜")),Q("mjx-container",w,[(l(),t("svg",c,T[20]||(T[20]=[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[21]||(T[21]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"x")])],-1))]),T[25]||(T[25]=a("的雅可比符号")),Q("mjx-container",Z,[(l(),t("svg",v,T[22]||(T[22]=[m('',1)]))),T[23]||(T[23]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mrow",{"data-mjx-texclass":"INNER"},[Q("mo",{"data-mjx-texclass":"OPEN"},"("),Q("mi",null,"x"),Q("mo",null,"∣"),Q("mi",null,"n"),Q("mo",{"data-mjx-texclass":"CLOSE"},")")])])],-1))]),T[26]||(T[26]=a("是1还是-1,并且把猜测的结果发送给Alice"))]),Q("li",null,[T[29]||(T[29]=a("Alice向Bob出示")),Q("mjx-container",y,[(l(),t("svg",j,T[27]||(T[27]=[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[28]||(T[28]=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[32]||(T[32]=a("Bob且向Alice出示")),Q("mjx-container",b,[(l(),t("svg",D,T[30]||(T[30]=[m('',1)]))),T[31]||(T[31]=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[33]||(T[33]=Q("li",null,"双方根据Bob是否猜对来决定硬币是正面还是反面,并且检测对方在这个过程中有没有作弊。",-1))]),T[192]||(T[192]=Q("p",null,"这个协议利了数论中的一些基本知识,因为并不算复杂,这里先简单介绍一下:",-1)),T[193]||(T[193]=Q("hr",null,null,-1)),T[194]||(T[194]=Q("h4",{id:"二次剩余-quadratic-residue",tabindex:"-1"},[Q("a",{class:"header-anchor",href:"#二次剩余-quadratic-residue"},[Q("span",null,[a("二次剩余("),Q("a",{href:"https://en.wikipedia.org/wiki/Quadratic_residue",target:"_blank",rel:"noopener noreferrer"},"Quadratic residue"),a(")")])])],-1)),Q("blockquote",null,[Q("p",null,[T[46]||(T[46]=a("对于整数")),Q("mjx-container",k,[(l(),t("svg",C,T[34]||(T[34]=[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[35]||(T[35]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"n")])],-1))]),T[47]||(T[47]=a("和")),Q("mjx-container",B,[(l(),t("svg",S,T[36]||(T[36]=[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":"1D45E",d:"M33 157Q33 258 109 349T280 441Q340 441 372 389Q373 390 377 395T388 406T404 418Q438 442 450 442Q454 442 457 439T460 434Q460 425 391 149Q320 -135 320 -139Q320 -147 365 -148H390Q396 -156 396 -157T393 -175Q389 -188 383 -194H370Q339 -192 262 -192Q234 -192 211 -192T174 -192T157 -193Q143 -193 143 -185Q143 -182 145 -170Q149 -154 152 -151T172 -148Q220 -148 230 -141Q238 -136 258 -53T279 32Q279 33 272 29Q224 -10 172 -10Q117 -10 75 30T33 157ZM352 326Q329 405 277 405Q242 405 210 374T160 293Q131 214 119 129Q119 126 119 118T118 106Q118 61 136 44T179 26Q233 26 290 98L298 109L352 326Z"})])])],-1)]))),T[37]||(T[37]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"q")])],-1))]),T[48]||(T[48]=a(",如果存在整数")),Q("mjx-container",E,[(l(),t("svg",J,T[38]||(T[38]=[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[39]||(T[39]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"x")])],-1))]),T[49]||(T[49]=a("满足")),Q("mjx-container",G,[(l(),t("svg",O,T[40]||(T[40]=[m('',1)]))),T[41]||(T[41]=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,"q"),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[50]||(T[50]=a(",那么就称")),Q("mjx-container",R,[(l(),t("svg",N,T[42]||(T[42]=[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":"1D45E",d:"M33 157Q33 258 109 349T280 441Q340 441 372 389Q373 390 377 395T388 406T404 418Q438 442 450 442Q454 442 457 439T460 434Q460 425 391 149Q320 -135 320 -139Q320 -147 365 -148H390Q396 -156 396 -157T393 -175Q389 -188 383 -194H370Q339 -192 262 -192Q234 -192 211 -192T174 -192T157 -193Q143 -193 143 -185Q143 -182 145 -170Q149 -154 152 -151T172 -148Q220 -148 230 -141Q238 -136 258 -53T279 32Q279 33 272 29Q224 -10 172 -10Q117 -10 75 30T33 157ZM352 326Q329 405 277 405Q242 405 210 374T160 293Q131 214 119 129Q119 126 119 118T118 106Q118 61 136 44T179 26Q233 26 290 98L298 109L352 326Z"})])])],-1)]))),T[43]||(T[43]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"q")])],-1))]),T[51]||(T[51]=a("是")),Q("mjx-container",A,[(l(),t("svg",P,T[44]||(T[44]=[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[45]||(T[45]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"n")])],-1))]),T[52]||(T[52]=a("的二次剩余"))])]),Q("p",null,[T[57]||(T[57]=a("比如2就是7的一个二次剩余,因为")),Q("mjx-container",q,[(l(),t("svg",z,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("mn",null,"3"),Q("mn",null,"2")]),Q("mo",null,"≡"),Q("mn",null,"2"),Q("mspace",{width:"0.444em"}),Q("mo",{stretchy:"false"},"("),Q("mi",null,"mod"),Q("mspace",{width:"0.333em"}),Q("mn",null,"7"),Q("mo",{stretchy:"false"},")")])],-1))]),T[58]||(T[58]=a(",但5就不是7的二次剩余,因为找不到一个数满足")),Q("mjx-container",F,[(l(),t("svg",I,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("msup",null,[Q("mi",null,"x"),Q("mn",null,"2")]),Q("mo",null,"≡"),Q("mn",null,"5"),Q("mspace",{width:"0.444em"}),Q("mo",{stretchy:"false"},"("),Q("mi",null,"mod"),Q("mspace",{width:"0.333em"}),Q("mn",null,"7"),Q("mo",{stretchy:"false"},")")])],-1))]),T[59]||(T[59]=a(",这种情况称5是7的二次非剩余。"))]),T[195]||(T[195]=Q("hr",null,null,-1)),T[196]||(T[196]=Q("h4",{id:"勒让德-雅可比符号",tabindex:"-1"},[Q("a",{class:"header-anchor",href:"#勒让德-雅可比符号"},[Q("span",null,"勒让德-雅可比符号")])],-1)),Q("blockquote",null,[Q("p",null,[T[64]||(T[64]=a("设")),Q("mjx-container",X,[(l(),t("svg",Y,T[60]||(T[60]=[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":"1D45D",d:"M23 287Q24 290 25 295T30 317T40 348T55 381T75 411T101 433T134 442Q209 442 230 378L240 387Q302 442 358 442Q423 442 460 395T497 281Q497 173 421 82T249 -10Q227 -10 210 -4Q199 1 187 11T168 28L161 36Q160 35 139 -51T118 -138Q118 -144 126 -145T163 -148H188Q194 -155 194 -157T191 -175Q188 -187 185 -190T172 -194Q170 -194 161 -194T127 -193T65 -192Q-5 -192 -24 -194H-32Q-39 -187 -39 -183Q-37 -156 -26 -148H-6Q28 -147 33 -136Q36 -130 94 103T155 350Q156 355 156 364Q156 405 131 405Q109 405 94 377T71 316T59 280Q57 278 43 278H29Q23 284 23 287ZM178 102Q200 26 252 26Q282 26 310 49T356 107Q374 141 392 215T411 325V331Q411 405 350 405Q339 405 328 402T306 393T286 380T269 365T254 350T243 336T235 326L232 322Q232 321 229 308T218 264T204 212Q178 106 178 102Z"})])])],-1)]))),T[61]||(T[61]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"p")])],-1))]),T[65]||(T[65]=a("是一个大于2的质数,")),Q("mjx-container",K,[(l(),t("svg",W,T[62]||(T[62]=[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":"1D44E",d:"M33 157Q33 258 109 349T280 441Q331 441 370 392Q386 422 416 422Q429 422 439 414T449 394Q449 381 412 234T374 68Q374 43 381 35T402 26Q411 27 422 35Q443 55 463 131Q469 151 473 152Q475 153 483 153H487Q506 153 506 144Q506 138 501 117T481 63T449 13Q436 0 417 -8Q409 -10 393 -10Q359 -10 336 5T306 36L300 51Q299 52 296 50Q294 48 292 46Q233 -10 172 -10Q117 -10 75 30T33 157ZM351 328Q351 334 346 350T323 385T277 405Q242 405 210 374T160 293Q131 214 119 129Q119 126 119 118T118 106Q118 61 136 44T179 26Q217 26 254 59T298 110Q300 114 325 217T351 328Z"})])])],-1)]))),T[63]||(T[63]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"a")])],-1))]),T[66]||(T[66]=a("是一正整数,那么定义勒让德符号(")),T[67]||(T[67]=Q("a",{href:"https://en.wikipedia.org/wiki/Legendre_symbol",target:"_blank",rel:"noopener noreferrer"},"Legendre Symbol",-1)),T[68]||(T[68]=a(")如下:"))]),Q("mjx-container",U,[(l(),t("svg",$,T[69]||(T[69]=[m('是的二次剩余是的二次非剩余是的倍数',1)]))),T[70]||(T[70]=Q("mjx-assistive-mml",{unselectable:"on",display:"block"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML",display:"block"},[Q("mtable",{displaystyle:"true"},[Q("mlabeledtr",null,[Q("mtd",null,[Q("mtext",null,"(1)")]),Q("mtd",null,[Q("mstyle",{displaystyle:"true",scriptlevel:"0"},[Q("mrow",{"data-mjx-texclass":"ORD"},[Q("mrow",{"data-mjx-texclass":"INNER"},[Q("mo",{"data-mjx-texclass":"OPEN"},"("),Q("mfrac",null,[Q("mi",null,"a"),Q("mi",null,"p")]),Q("mo",{"data-mjx-texclass":"CLOSE"},")")]),Q("mo",null,"="),Q("mrow",{"data-mjx-texclass":"INNER"},[Q("mo",{"data-mjx-texclass":"OPEN"},"{"),Q("mtable",{rowspacing:".1em",columnspacing:"1em",columnalign:"left left"},[Q("mtr",null,[Q("mtd",null,[Q("mn",null,"1")]),Q("mtd",null,[Q("mrow",null,[Q("mrow",{"data-mjx-texclass":"ORD"},[Q("mi",null,"a")]),Q("mtext",null,"是"),Q("mrow",{"data-mjx-texclass":"ORD"},[Q("mi",null,"p")]),Q("mtext",null,"的二次剩余")])])]),Q("mtr",null,[Q("mtd",null,[Q("mo",null,"−"),Q("mn",null,"1")]),Q("mtd",null,[Q("mrow",null,[Q("mrow",{"data-mjx-texclass":"ORD"},[Q("mi",null,"a")]),Q("mtext",null,"是"),Q("mrow",{"data-mjx-texclass":"ORD"},[Q("mi",null,"p")]),Q("mtext",null,"的二次非剩余")])])]),Q("mtr",null,[Q("mtd",null,[Q("mn",null,"0")]),Q("mtd",null,[Q("mrow",null,[Q("mrow",{"data-mjx-texclass":"ORD"},[Q("mi",null,"a")]),Q("mtext",null,"是"),Q("mrow",{"data-mjx-texclass":"ORD"},[Q("mi",null,"p")]),Q("mtext",null,"的倍数")])])])]),Q("mo",{"data-mjx-texclass":"CLOSE",fence:"true",stretchy:"true",symmetric:"true"})])])])])])])])],-1))])]),Q("p",null,[T[75]||(T[75]=a("勒让德符号一般用")),Q("mjx-container",_,[(l(),t("svg",Q1,T[71]||(T[71]=[m('',1)]))),T[72]||(T[72]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mrow",{"data-mjx-texclass":"INNER"},[Q("mo",{"data-mjx-texclass":"OPEN"},"("),Q("mfrac",null,[Q("mi",null,"a"),Q("mi",null,"p")]),Q("mo",{"data-mjx-texclass":"CLOSE"},")")])])],-1))]),T[76]||(T[76]=a("或者")),Q("mjx-container",T1,[(l(),t("svg",a1,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("mo",{stretchy:"false"},"("),Q("mi",null,"a"),Q("mo",null,"∣"),Q("mi",null,"p"),Q("mo",{stretchy:"false"},")")])],-1))]),T[77]||(T[77]=a("表示,可以直接用欧拉准则(")),T[78]||(T[78]=Q("a",{href:"https://en.wikipedia.org/wiki/Euler%27s_criterion",target:"_blank",rel:"noopener noreferrer"},"Euler’s criterion",-1)),T[79]||(T[79]=a(")计算"))]),Q("mjx-container",t1,[(l(),t("svg",l1,T[80]||(T[80]=[m('',1)]))),T[81]||(T[81]=Q("mjx-assistive-mml",{unselectable:"on",display:"block"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML",display:"block"},[Q("mtable",{displaystyle:"true"},[Q("mlabeledtr",null,[Q("mtd",null,[Q("mtext",null,"(2)")]),Q("mtd",null,[Q("mstyle",{displaystyle:"true",scriptlevel:"0"},[Q("mrow",{"data-mjx-texclass":"ORD"},[Q("mrow",{"data-mjx-texclass":"INNER"},[Q("mo",{"data-mjx-texclass":"OPEN"},"("),Q("mfrac",null,[Q("mi",null,"a"),Q("mi",null,"p")]),Q("mo",{"data-mjx-texclass":"CLOSE"},")")]),Q("mo",null,"="),Q("msup",null,[Q("mi",null,"a"),Q("mrow",{"data-mjx-texclass":"ORD"},[Q("mo",{stretchy:"false"},"("),Q("mi",null,"p"),Q("mo",null,"−"),Q("mn",null,"1"),Q("mo",{stretchy:"false"},")"),Q("mrow",{"data-mjx-texclass":"ORD"},[Q("mo",null,"/")]),Q("mn",null,"2")])]),Q("mspace",{width:"1em"}),Q("mo",{stretchy:"false"},"("),Q("mi",null,"mod"),Q("mspace",{width:"0.333em"}),Q("mi",null,"p"),Q("mo",{stretchy:"false"},")")])])])])])])],-1))]),T[197]||(T[197]=Q("p",null,"比如",-1)),Q("mjx-container",m1,[(l(),t("svg",n1,T[82]||(T[82]=[m('',1)]))),T[83]||(T[83]=Q("mjx-assistive-mml",{unselectable:"on",display:"block"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML",display:"block"},[Q("mo",{stretchy:"false"},"("),Q("mn",null,"9"),Q("mo",null,"∣"),Q("mn",null,"13"),Q("mo",{stretchy:"false"},")"),Q("mo",null,"="),Q("msup",null,[Q("mn",null,"9"),Q("mrow",{"data-mjx-texclass":"ORD"},[Q("mo",{stretchy:"false"},"("),Q("mn",null,"13"),Q("mo",null,"−"),Q("mn",null,"1"),Q("mo",{stretchy:"false"},")"),Q("mrow",{"data-mjx-texclass":"ORD"},[Q("mo",null,"/")]),Q("mn",null,"2")])]),Q("mspace",{width:"1em"}),Q("mo",{stretchy:"false"},"("),Q("mi",null,"mod"),Q("mspace",{width:"0.333em"}),Q("mn",null,"13"),Q("mo",{stretchy:"false"},")"),Q("mo",null,"="),Q("mn",null,"1")])],-1))]),T[198]||(T[198]=Q("p",null,"所以9是13的二次剩余。 而",-1)),Q("mjx-container",e1,[(l(),t("svg",s1,T[84]||(T[84]=[m('',1)]))),T[85]||(T[85]=Q("mjx-assistive-mml",{unselectable:"on",display:"block"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML",display:"block"},[Q("mo",{stretchy:"false"},"("),Q("mn",null,"10"),Q("mo",null,"∣"),Q("mn",null,"13"),Q("mo",{stretchy:"false"},")"),Q("mo",null,"="),Q("msup",null,[Q("mn",null,"10"),Q("mrow",{"data-mjx-texclass":"ORD"},[Q("mo",{stretchy:"false"},"("),Q("mn",null,"13"),Q("mo",null,"−"),Q("mn",null,"1"),Q("mo",{stretchy:"false"},")"),Q("mrow",{"data-mjx-texclass":"ORD"},[Q("mo",null,"/")]),Q("mn",null,"2")])]),Q("mspace",{width:"1em"}),Q("mo",{stretchy:"false"},"("),Q("mi",null,"mod"),Q("mspace",{width:"0.333em"}),Q("mn",null,"13"),Q("mo",{stretchy:"false"},")"),Q("mo",null,"="),Q("mo",null,"−"),Q("mn",null,"1")])],-1))]),Q("p",null,[T[88]||(T[88]=a("所以10是13的二次非剩余, 这是由于在同余系统中")),Q("mjx-container",r1,[(l(),t("svg",o1,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("mi",null,"p"),Q("mo",null,"−"),Q("mn",null,"1"),Q("mo",null,"≡"),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,"p"),Q("mo",{stretchy:"false"},")")])],-1))])]),Q("p",null,[T[95]||(T[95]=a("将勒让德符号扩展到合数")),Q("mjx-container",d1,[(l(),t("svg",i1,T[89]||(T[89]=[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[90]||(T[90]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"n")])],-1))]),T[96]||(T[96]=a("就是雅可比符号(")),T[97]||(T[97]=Q("a",{href:"https://en.wikipedia.org/wiki/Jacobi_symbol",target:"_blank",rel:"noopener noreferrer"},"Jacobi symbol",-1)),T[98]||(T[98]=a("),同样用")),Q("mjx-container",g1,[(l(),t("svg",h1,T[91]||(T[91]=[m('',1)]))),T[92]||(T[92]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mrow",{"data-mjx-texclass":"INNER"},[Q("mo",{"data-mjx-texclass":"OPEN"},"("),Q("mfrac",null,[Q("mi",null,"a"),Q("mi",null,"n")]),Q("mo",{"data-mjx-texclass":"CLOSE"},")")])])],-1))]),T[99]||(T[99]=a("或者")),Q("mjx-container",H1,[(l(),t("svg",p1,T[93]||(T[93]=[m('',1)]))),T[94]||(T[94]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mo",{stretchy:"false"},"("),Q("mi",null,"a"),Q("mo",null,"∣"),Q("mi",null,"n"),Q("mo",{stretchy:"false"},")")])],-1))]),T[100]||(T[100]=a("表示。"))]),Q("blockquote",null,[Q("p",null,[T[105]||(T[105]=a("合数")),Q("mjx-container",V1,[(l(),t("svg",f1,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":"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[102]||(T[102]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"n")])],-1))]),T[106]||(T[106]=a("可以表达成多个质因子的乘积,也就是")),Q("mjx-container",x1,[(l(),t("svg",L1,T[103]||(T[103]=[m('',1)]))),T[104]||(T[104]=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("msub",null,[Q("mi",null,"p"),Q("mn",null,"1")]),Q("msub",null,[Q("mi",null,"p"),Q("mn",null,"2")]),Q("mo",null,"⋯"),Q("msub",null,[Q("mi",null,"p"),Q("mi",null,"k")])])],-1))]),T[107]||(T[107]=a(",那么定义雅可比符号"))]),Q("mjx-container",u1,[(l(),t("svg",M1,T[108]||(T[108]=[m('',1)]))),T[109]||(T[109]=Q("mjx-assistive-mml",{unselectable:"on",display:"block"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML",display:"block"},[Q("mtable",{displaystyle:"true"},[Q("mlabeledtr",null,[Q("mtd",null,[Q("mtext",null,"(3)")]),Q("mtd",null,[Q("mstyle",{displaystyle:"true",scriptlevel:"0"},[Q("mrow",{"data-mjx-texclass":"INNER"},[Q("mo",{"data-mjx-texclass":"OPEN"},"("),Q("mfrac",null,[Q("mi",null,"a"),Q("mi",null,"n")]),Q("mo",{"data-mjx-texclass":"CLOSE"},")")]),Q("mo",null,"="),Q("mrow",{"data-mjx-texclass":"INNER"},[Q("mo",{"data-mjx-texclass":"OPEN"},"("),Q("mfrac",null,[Q("mi",null,"a"),Q("msub",null,[Q("mi",null,"p"),Q("mn",null,"1")])]),Q("mo",{"data-mjx-texclass":"CLOSE"},")")]),Q("mrow",{"data-mjx-texclass":"INNER"},[Q("mo",{"data-mjx-texclass":"OPEN"},"("),Q("mfrac",null,[Q("mi",null,"a"),Q("msub",null,[Q("mi",null,"p"),Q("mn",null,"2")])]),Q("mo",{"data-mjx-texclass":"CLOSE"},")")]),Q("mo",null,"⋯"),Q("mrow",{"data-mjx-texclass":"INNER"},[Q("mo",{"data-mjx-texclass":"OPEN"},"("),Q("mfrac",null,[Q("mi",null,"a"),Q("msub",null,[Q("mi",null,"p"),Q("mi",null,"k")])]),Q("mo",{"data-mjx-texclass":"CLOSE"},")")])])])])])])],-1))])]),T[199]||(T[199]=Q("p",null,"比如",-1)),Q("mjx-container",w1,[(l(),t("svg",c1,T[110]||(T[110]=[m('',1)]))),T[111]||(T[111]=Q("mjx-assistive-mml",{unselectable:"on",display:"block"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML",display:"block"},[Q("mstyle",{displaystyle:"true",scriptlevel:"0"},[Q("mrow",{"data-mjx-texclass":"ORD"},[Q("mrow",{"data-mjx-texclass":"INNER"},[Q("mo",{"data-mjx-texclass":"OPEN"},"("),Q("mfrac",null,[Q("mn",null,"7"),Q("mn",null,"143")]),Q("mo",{"data-mjx-texclass":"CLOSE"},")")]),Q("mo",null,"="),Q("mrow",{"data-mjx-texclass":"INNER"},[Q("mo",{"data-mjx-texclass":"OPEN"},"("),Q("mfrac",null,[Q("mn",null,"7"),Q("mn",null,"11")]),Q("mo",{"data-mjx-texclass":"CLOSE"},")")]),Q("mrow",{"data-mjx-texclass":"INNER"},[Q("mo",{"data-mjx-texclass":"OPEN"},"("),Q("mfrac",null,[Q("mn",null,"7"),Q("mn",null,"13")]),Q("mo",{"data-mjx-texclass":"CLOSE"},")")]),Q("mo",null,"="),Q("mo",{stretchy:"false"},"("),Q("mo",null,"−"),Q("mn",null,"1"),Q("mo",{stretchy:"false"},")"),Q("mo",{stretchy:"false"},"("),Q("mo",null,"−"),Q("mn",null,"1"),Q("mo",{stretchy:"false"},")"),Q("mo",null,"="),Q("mn",null,"1")])])])],-1))]),Q("p",null,[T[114]||(T[114]=a("需要注意的是,对于合数,雅可比符号并不能判断二次剩余,比如上面的例子中,尽管")),Q("mjx-container",Z1,[(l(),t("svg",v1,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("mo",{stretchy:"false"},"("),Q("mn",null,"7"),Q("mo",{"data-mjx-texclass":"ORD",stretchy:"false"},"|"),Q("mn",null,"143"),Q("mo",{stretchy:"false"},")"),Q("mo",null,"="),Q("mn",null,"1")])],-1))]),T[115]||(T[115]=a(",但7并不是143的二次剩余"))]),T[200]||(T[200]=Q("hr",null,null,-1)),T[201]||(T[201]=Q("h4",{id:"blum整数-blum-integer",tabindex:"-1"},[Q("a",{class:"header-anchor",href:"#blum整数-blum-integer"},[Q("span",null,[a("Blum整数("),Q("a",{href:"https://en.wikipedia.org/wiki/Blum_integer",target:"_blank",rel:"noopener noreferrer"},"Blum Integer"),a(")")])])],-1)),Q("blockquote",null,[Q("p",null,[T[122]||(T[122]=a("如果有质数")),Q("mjx-container",y1,[(l(),t("svg",j1,T[116]||(T[116]=[m('',1)]))),T[117]||(T[117]=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[123]||(T[123]=a(",满足")),Q("mjx-container",b1,[(l(),t("svg",D1,T[118]||(T[118]=[m('',1)]))),T[119]||(T[119]=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[124]||(T[124]=a(",那么称它们的乘积")),Q("mjx-container",k1,[(l(),t("svg",C1,T[120]||(T[120]=[m('',1)]))),T[121]||(T[121]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"p"),Q("mi",null,"q")])],-1))]),T[125]||(T[125]=a("为Blum整数"))])]),Q("p",null,[T[130]||(T[130]=a("比如21(3×7),33(3×11),133(7×19)都是Blum整数,Blum整数在加密领域用途非常广泛,因为它有很多有用的特性,比如说")),Q("mjx-container",B1,[(l(),t("svg",S1,T[126]||(T[126]=[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":"1D44E",d:"M33 157Q33 258 109 349T280 441Q331 441 370 392Q386 422 416 422Q429 422 439 414T449 394Q449 381 412 234T374 68Q374 43 381 35T402 26Q411 27 422 35Q443 55 463 131Q469 151 473 152Q475 153 483 153H487Q506 153 506 144Q506 138 501 117T481 63T449 13Q436 0 417 -8Q409 -10 393 -10Q359 -10 336 5T306 36L300 51Q299 52 296 50Q294 48 292 46Q233 -10 172 -10Q117 -10 75 30T33 157ZM351 328Q351 334 346 350T323 385T277 405Q242 405 210 374T160 293Q131 214 119 129Q119 126 119 118T118 106Q118 61 136 44T179 26Q217 26 254 59T298 110Q300 114 325 217T351 328Z"})])])],-1)]))),T[127]||(T[127]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"a")])],-1))]),T[131]||(T[131]=a("是Blum整数")),Q("mjx-container",E1,[(l(),t("svg",J1,T[128]||(T[128]=[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[129]||(T[129]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"n")])],-1))]),T[132]||(T[132]=a("的一个二次剩余,那么考察下面的二次剩余方程"))]),Q("mjx-container",G1,[(l(),t("svg",O1,T[133]||(T[133]=[m('',1)]))),T[134]||(T[134]=Q("mjx-assistive-mml",{unselectable:"on",display:"block"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML",display:"block"},[Q("msup",null,[Q("mi",null,"x"),Q("mn",null,"2")]),Q("mo",null,"≡"),Q("mi",null,"a"),Q("mspace",{width:"1em"}),Q("mo",{stretchy:"false"},"("),Q("mi",null,"mod"),Q("mspace",{width:"0.333em"}),Q("mi",null,"n"),Q("mo",{stretchy:"false"},")")])],-1))]),Q("p",null,[T[149]||(T[149]=a("首先这个方程有且只有4个解,如果知道n的两个质因子")),Q("mjx-container",R1,[(l(),t("svg",N1,T[135]||(T[135]=[m('',1)]))),T[136]||(T[136]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"p"),Q("mi",null,"q")])],-1))]),T[150]||(T[150]=a("的情况下,可以在常数时间内计算出这四个解(一般数论书中都有求解二次剩余方程的方法,这里不再详述),但如果不知道质因子")),Q("mjx-container",A1,[(l(),t("svg",P1,T[137]||(T[137]=[m('',1)]))),T[138]||(T[138]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"p"),Q("mi",null,"q")])],-1))]),T[151]||(T[151]=a("的话,解这个方程非常困难,难度和分解")),Q("mjx-container",q1,[(l(),t("svg",z1,T[139]||(T[139]=[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[140]||(T[140]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"n")])],-1))]),T[152]||(T[152]=a("的难度相等。")),T[153]||(T[153]=Q("br",null,null,-1)),T[154]||(T[154]=a(" 对于Blum整数")),Q("mjx-container",F1,[(l(),t("svg",I1,T[141]||(T[141]=[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[142]||(T[142]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"n")])],-1))]),T[155]||(T[155]=a(",这4个解的雅可比符号恰好有两个满足")),Q("mjx-container",X1,[(l(),t("svg",Y1,T[143]||(T[143]=[m('',1)]))),T[144]||(T[144]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[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[156]||(T[156]=a(",另两个解满足")),Q("mjx-container",K1,[(l(),t("svg",W1,T[145]||(T[145]=[m('',1)]))),T[146]||(T[146]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mo",{stretchy:"false"},"("),Q("mi",null,"x"),Q("mo",null,"∣"),Q("mi",null,"n"),Q("mo",{stretchy:"false"},")"),Q("mo",null,"="),Q("mo",null,"−"),Q("mn",null,"1")])],-1))]),T[157]||(T[157]=a(",比如方程")),Q("mjx-container",U1,[(l(),t("svg",$1,T[147]||(T[147]=[m('',1)]))),T[148]||(T[148]=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("mn",null,"4"),Q("mspace",{width:"0.444em"}),Q("mo",{stretchy:"false"},"("),Q("mi",null,"mod"),Q("mspace",{width:"0.333em"}),Q("mn",null,"21"),Q("mo",{stretchy:"false"},")")])],-1))]),T[158]||(T[158]=a(",四个解分别是2,19,5,16,其中(2|21)=(19|21)=-1,而(5|21)=(16|21)=1"))]),T[202]||(T[202]=Q("hr",null,null,-1)),Q("p",null,[T[171]||(T[171]=a("回到Blum抛币协议,当知道Blum整数这些特性后,理解这个协议就简单了,这个协议中一共有")),Q("mjx-container",_1,[(l(),t("svg",Q2,T[159]||(T[159]=[m('',1)]))),T[160]||(T[160]=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"),Q("mo",null,","),Q("mi",null,"n"),Q("mo",null,","),Q("mi",null,"x"),Q("mo",null,","),Q("mi",null,"y")])],-1))]),T[172]||(T[172]=a("这几个数,在完成第3步(也就是硬币入井)的时候,Alice知道")),Q("mjx-container",T2,[(l(),t("svg",a2,T[161]||(T[161]=[m('',1)]))),T[162]||(T[162]=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,"x"),Q("mo",null,","),Q("mi",null,"y")])],-1))]),T[173]||(T[173]=a(",Bob知道")),Q("mjx-container",t2,[(l(),t("svg",l2,T[163]||(T[163]=[m('',1)]))),T[164]||(T[164]=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"),Q("mo",null,","),Q("mi",null,"n"),Q("mo",null,","),Q("mi",null,"y")])],-1))]),T[174]||(T[174]=Q("br",null,null,-1)),T[175]||(T[175]=a(" 对于Bob来说,由于他知道")),Q("mjx-container",m2,[(l(),t("svg",n2,T[165]||(T[165]=[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[166]||(T[166]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"n")])],-1))]),T[176]||(T[176]=a("的两个质因子,所以他能解出")),Q("mjx-container",e2,[(l(),t("svg",s2,T[167]||(T[167]=[m('',1)]))),T[168]||(T[168]=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[177]||(T[177]=a("的4个解,但正如我们上面的分析,这4个解中有两个的雅可比符号是1,另两个是-1,所以他猜对的概率是50%,这也保证了这个协议产生的随机数一定是均匀的。")),T[178]||(T[178]=Q("br",null,null,-1)),T[179]||(T[179]=a(" 那么Alice有可能作弊吗?如果她想作弊,那么她需要准备两个")),Q("mjx-container",r2,[(l(),t("svg",o2,T[169]||(T[169]=[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[170]||(T[170]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"x")])],-1))]),T[180]||(T[180]=a(",满足"))]),Q("mjx-container",d2,[(l(),t("svg",i2,T[181]||(T[181]=[m('',1)]))),T[182]||(T[182]=Q("mjx-assistive-mml",{unselectable:"on",display:"block"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML",display:"block"},[Q("msubsup",null,[Q("mi",null,"x"),Q("mn",null,"1"),Q("mn",null,"2")]),Q("mo",null,"≡"),Q("msubsup",null,[Q("mi",null,"x"),Q("mn",null,"2"),Q("mn",null,"2")]),Q("mspace",{width:"1em"}),Q("mo",{stretchy:"false"},"("),Q("mi",null,"mod"),Q("mspace",{width:"0.333em"}),Q("mi",null,"n"),Q("mo",{stretchy:"false"},")")])],-1))]),T[203]||(T[203]=Q("p",null,"并且",-1)),Q("mjx-container",g2,[(l(),t("svg",h2,T[183]||(T[183]=[m('',1)]))),T[184]||(T[184]=Q("mjx-assistive-mml",{unselectable:"on",display:"block"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML",display:"block"},[Q("mo",{stretchy:"false"},"("),Q("msub",null,[Q("mi",null,"x"),Q("mn",null,"1")]),Q("mo",null,"∣"),Q("mi",null,"n"),Q("mo",{stretchy:"false"},")"),Q("mo",null,"≠"),Q("mo",{stretchy:"false"},"("),Q("msub",null,[Q("mi",null,"x"),Q("mn",null,"2")]),Q("mo",null,"∣"),Q("mi",null,"n"),Q("mo",{stretchy:"false"},")")])],-1))]),T[204]||(T[204]=Q("p",null,"那么根据Blum整数的其他特性,可以推导出",-1)),Q("mjx-container",H2,[(l(),t("svg",p2,T[185]||(T[185]=[m('',1)]))),T[186]||(T[186]=Q("mjx-assistive-mml",{unselectable:"on",display:"block"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML",display:"block"},[Q("msubsup",null,[Q("mi",null,"x"),Q("mn",null,"1"),Q("mn",null,"2")]),Q("mo",null,"−"),Q("msubsup",null,[Q("mi",null,"x"),Q("mn",null,"2"),Q("mn",null,"2")]),Q("mo",null,"="),Q("mo",{stretchy:"false"},"("),Q("msub",null,[Q("mi",null,"x"),Q("mn",null,"1")]),Q("mo",null,"+"),Q("msub",null,[Q("mi",null,"x"),Q("mn",null,"2")]),Q("mo",{stretchy:"false"},")"),Q("mo",{stretchy:"false"},"("),Q("msub",null,[Q("mi",null,"x"),Q("mn",null,"1")]),Q("mo",null,"−"),Q("msub",null,[Q("mi",null,"x"),Q("mn",null,"2")]),Q("mo",{stretchy:"false"},")"),Q("mo",null,"≡"),Q("mn",null,"0"),Q("mspace",{width:"1em"}),Q("mo",{stretchy:"false"},"("),Q("mi",null,"mod"),Q("mspace",{width:"0.333em"}),Q("mi",null,"n"),Q("mo",{stretchy:"false"},")")])],-1))]),Q("p",null,[T[189]||(T[189]=a("这相当于分解了")),Q("mjx-container",V2,[(l(),t("svg",f2,T[187]||(T[187]=[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[188]||(T[188]=Q("mjx-assistive-mml",{unselectable:"on",display:"inline"},[Q("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[Q("mi",null,"n")])],-1))]),T[190]||(T[190]=a(",而大数分解又是著名难题,所以Alice也不可能作弊"))])])}const M2=n(o,[["render",x2],["__file","MentalPoker01.html.vue"]]),w2=JSON.parse('{"path":"/blog/2025/02/MentalPoker01.html","title":"从抛币协议到智能合约(一)","lang":"zh-CN","frontmatter":{"title":"从抛币协议到智能合约(一)","tags":"数学 加密","next":{"text":"从抛币协议到智能合约(二)","link":"MentalPoker02.md"}},"headers":[],"git":{"updatedTime":1740225290000,"contributors":[{"name":"thejinchao","username":"thejinchao","email":"thejinchao@gmail.com","commits":1,"url":"https://github.com/thejinchao"}]},"filePathRelative":"blog/2025/02/MentalPoker01.md"}');export{M2 as comp,w2 as data};