Lamport 的单次签名 (Lamport’s One-Time Signature Scheme) . 假设 f f f 是一个(单向)函数,令 l ( κ ) l(\kappa) l ( κ ) 表示要签名的消息的长度。
SigGen ( 1 κ ) → ( v k , s k ) \text{SigGen}(1^\kappa)\rightarrow (vk,sk) SigGen ( 1 κ ) → ( v k , s k ) . x i , 0 , x i , 1 ← { 0 , 1 } κ , i ∈ [ l ] ; y i , 0 / 1 = f ( x i , 0 / 1 ) , i ∈ [ l ] x_{i,0},x_{i,1}\leftarrow \{0,1\}^\kappa,i\in[l]; y_{i,0/1}=f(x_{i,0/1}),i\in[l] x i , 0 , x i , 1 ← { 0 , 1 } κ , i ∈ [ l ] ; y i , 0/1 = f ( x i , 0/1 ) , i ∈ [ l ] . 那么令s k = ( x 1 , 0 x 2 , 0 ⋯ x l , 0 x 1 , 1 x 2 , 1 ⋯ x l , 1 ) , v k = ( y 1 , 0 y 2 , 0 ⋯ y l , 0 y 1 , 1 y 2 , 1 ⋯ y l , 1 ) sk=\left(\begin{matrix}x_{1,0}&x_{2,0}&\cdots&x_{l,0}\\x_{1,1}&x_{2,1}&\cdots&x_{l,1}\end{matrix}\right),\quad vk=\left(\begin{matrix}y_{1,0}&y_{2,0}&\cdots&y_{l,0}\\y_{1,1}&y_{2,1}&\cdots&y_{l,1}\end{matrix}\right) s k = ( x 1 , 0 x 1 , 1 x 2 , 0 x 2 , 1 ⋯ ⋯ x l , 0 x l , 1 ) , v k = ( y 1 , 0 y 1 , 1 y 2 , 0 y 2 , 1 ⋯ ⋯ y l , 0 y l , 1 ) Sign ( s k , m ) → σ \text{Sign}(sk,m)\rightarrow\sigma Sign ( s k , m ) → σ . 设 m ∈ { 0 , 1 } l m\in\{0,1\}^l m ∈ { 0 , 1 } l ,那么返回 σ = ( x 1 , m 1 , x 2 , m 2 , ⋯ , x l , m l ) \sigma=(x_{1,m_1},x_{2,m_2},\cdots,x_{l,m_l}) σ = ( x 1 , m 1 , x 2 , m 2 , ⋯ , x l , m l ) .Vrfy ( v k , ( m , σ ) ) \text{Vrfy}(vk,(m,\sigma)) Vrfy ( v k , ( m , σ )) . 给定 m = ( m 1 , m 2 , ⋯ , m l ) m=(m_1,m_2,\cdots,m_l) m = ( m 1 , m 2 , ⋯ , m l ) 以及 σ = ( x 1 , x 2 , ⋯ , x l ) \sigma=(x_1,x_2,\cdots,x_l) σ = ( x 1 , x 2 , ⋯ , x l ) ,验证是否满足 ∧ i = 1 l ( f ( x i ) = y i , m i ) \wedge_{i=1}^l (f(x_i)=y_{i,m_i}) ∧ i = 1 l ( f ( x i ) = y i , m i ) ;如果是返回 1,否则返回 0。💡
该单次签名的单次不可伪造性 (OT-UF-CMA) 是由单向函数的 f f f 的存在性提供的 ,也就是说:如果存在能打破该单次签名的单次不可伪造性的敌手
F \mathcal{F} F ,那么我们可以利用其构造中间敌手
I \mathcal{I} I 打破函数
f f f 的单向性。
【证明】 考虑安全规约:
C ′ I / C F ⟶ 1 κ , f , y i ∗ ← [ l ] , b ∗ ← { 0 , 1 } , y i ∗ , b ∗ = y i ∈ [ l ] , b ∈ { 0 , 1 } , ( i , b ) ≠ ( i ∗ , b ∗ ) : x i , b ← { 0 , 1 } κ , y i , b = f ( x i , b ) v k = ( y 1 , 0 y 2 , 0 ⋯ y l , 0 y 1 , 1 y 2 , 1 ⋯ y l , 1 ) s k = ( x 1 , 0 x 2 , 0 ⋯ x i ∗ , b ∗ / x i ∗ , 1 − b ∗ ⋯ x l , 0 x 1 , 1 x 2 , 1 ⋯ x i ∗ , 1 − b ∗ / x i ∗ , b ∗ ⋯ x l , 1 ) ⟶ v k if m i ∗ = b ∗ , return ⊥ ⟵ m σ = ( x 1 , m 1 , ⋯ , x l , m l ) ⟶ σ ⟵ σ i ∗ ′ σ ′ = ( σ 1 ′ , σ 2 ′ , ⋯ , σ l ′ ) ⟵ ( m ′ , σ ′ ) \color{darkblue}\small\begin{matrix}\mathcal{C'}& &\mathcal{I/C} & &\mathcal{F}\\ & \stackrel{1^\kappa, f,y}{\longrightarrow} & i^*\leftarrow[l],b^*\leftarrow\{0,1\},y_{i^*,b^*}=y \\ & & i\in[l],b\in\{0,1\},(i,b)\ne(i^*,b^*):x_{i,b}\leftarrow\{0,1\}^\kappa,y_{i,b}=f(x_{i,b})\\& & vk=\left(\begin{matrix}y_{1,0}&y_{2,0}&\cdots&y_{l,0}\\y_{1,1}&y_{2,1}&\cdots&y_{l,1}\end{matrix}\right) \\& & sk=\left(\begin{matrix}x_{1,0}&x_{2,0}&\cdots&x_{i^*,b^*}/x_{i^*,1-b^*}& \cdots&x_{l,0}\\x_{1,1}&x_{2,1}&\cdots&x_{i^*,1-b^*}/x_{i^*,b^*}&\cdots&x_{l,1}\end{matrix}\right) & \stackrel{vk}{\longrightarrow} \\ & &\text{if }m_{i^*}=b^*, \text{ return } \perp & \stackrel{m}{\longleftarrow}\\ & & \sigma=(x_{1,m_1},\cdots,x_{l,m_l}) & \stackrel{\sigma}{\longrightarrow} \\ & \stackrel{\sigma_{i^*}'}{\longleftarrow} &\sigma'=(\sigma_1',\sigma_2',\cdots,\sigma_l') & \stackrel{(m',\sigma')}{\longleftarrow}\end{matrix} C ′ ⟶ 1 κ , f , y ⟵ σ i ∗ ′ I / C i ∗ ← [ l ] , b ∗ ← { 0 , 1 } , y i ∗ , b ∗ = y i ∈ [ l ] , b ∈ { 0 , 1 } , ( i , b ) = ( i ∗ , b ∗ ) : x i , b ← { 0 , 1 } κ , y i , b = f ( x i , b ) v k = ( y 1 , 0 y 1 , 1 y 2 , 0 y 2 , 1 ⋯ ⋯ y l , 0 y l , 1 ) s k = ( x 1 , 0 x 1 , 1 x 2 , 0 x 2 , 1 ⋯ ⋯ x i ∗ , b ∗ / x i ∗ , 1 − b ∗ x i ∗ , 1 − b ∗ / x i ∗ , b ∗ ⋯ ⋯ x l , 0 x l , 1 ) if m i ∗ = b ∗ , return ⊥ σ = ( x 1 , m 1 , ⋯ , x l , m l ) σ ′ = ( σ 1 ′ , σ 2 ′ , ⋯ , σ l ′ ) ⟶ v k ⟵ m ⟶ σ ⟵ ( m ′ , σ ′ ) F 简单来说:我们把挑战者给的 y y y 嵌入第 b ∗ b^* b ∗ 行的第 i ∗ i^* i ∗ 个比特中,然后希望两点:
敌手 F \mathcal{F} F 询问的签名的第 i ∗ i^* i ∗ 个比特不是 b ∗ b^* b ∗ :因为如果是 b ∗ b^* b ∗ ,我们需要给出 y i ∗ , b ∗ = y y_{i^*,b^*}=y y i ∗ , b ∗ = y 对应的原象 x x x ,而这是我们给不出来的。这里的满足要求的概率是 1 / 2 1/2 1/2 。敌手 F \mathcal{F} F 伪造的签名的第 i ∗ i^* i ∗ 个比特正好就是 b ∗ b^* b ∗ :因为如果是 b ∗ b^* b ∗ ,从验证算法我们得知,一定有 f ( σ i ∗ = x i ∗ , b ∗ ) = y i ∗ , b ∗ = y f(\sigma_{i^*}=x_{i^*,b^*})=y_{i^*,b^*}=y f ( σ i ∗ = x i ∗ , b ∗ ) = y i ∗ , b ∗ = y ,即我们可以打破 f f f 的单向性。另一个等价说法是我们希望 m m m 和 m ′ m' m ′ 在第 i ∗ i^* i ∗ 个位置的比特不一样 。考虑极端情况下 m m m 和 m ′ m' m ′ 就一个比特不一样,那么有 1 / l 1/l 1/ l 的概率在第 i ∗ i^* i ∗ 个位置,满足这个要求。因此,注意到敌手 F \mathcal{F} F 并不知道中间敌手 I \mathcal{I} I 把 y y y 嵌在什么位置,因此
negl ( κ ) ≥ Pr [ x ← { 0 , 1 } κ ; y = f ( x ) ; x ′ ← I ( 1 κ , y ) : f ( x ′ ) = y ] = Pr [ ( m i ∗ ≠ b ∗ ) ∧ ( m i ∗ ′ = b ) ∧ F wins ] = Pr [ ( m i ∗ ≠ b ∗ ) ∧ ( m i ∗ ′ ≠ m i ∗ ) ∧ F wins ] = Pr [ m i ∗ ≠ b ∗ ] ⋅ Pr [ m i ∗ ′ ≠ m i ∗ ] ⋅ Pr [ F wins ] ≥ 1 2 ⋅ 1 l ⋅ Pr [ F wins ] = 1 2 l Pr [ F wins ] \begin{aligned}\text{negl}(\kappa)&\ge \text{Pr}[x\leftarrow\{0,1\}^\kappa;y=f(x);x'\leftarrow\mathcal{I}(1^\kappa,y):f(x')=y] \\ &=\text{Pr}[(m_{i^*}\ne b^*)\wedge(m_{i^*}' =b)\wedge \mathcal{F}\text{ wins}]\\&=\text{Pr}[(m_{i^*}\ne b^*)\wedge(m_{i^*}' \ne m_{i^*})\wedge \mathcal{F}\text{ wins}] \\&=\text{Pr}[m_{i^*}\ne b^*]\cdot\text{Pr}[m_{i^*}' \ne m_{i^*}]\cdot\text{Pr}[\mathcal{F}\text{ wins}] \\ &\ge \frac{1}{2}\cdot\frac{1}{l}\cdot\text{Pr}[\mathcal{F}\text{ wins}]\\&=\frac{1}{2l}\text{Pr}[\mathcal{F}\text{ wins}]\end{aligned} negl ( κ ) ≥ Pr [ x ← { 0 , 1 } κ ; y = f ( x ) ; x ′ ← I ( 1 κ , y ) : f ( x ′ ) = y ] = Pr [( m i ∗ = b ∗ ) ∧ ( m i ∗ ′ = b ) ∧ F wins ] = Pr [( m i ∗ = b ∗ ) ∧ ( m i ∗ ′ = m i ∗ ) ∧ F wins ] = Pr [ m i ∗ = b ∗ ] ⋅ Pr [ m i ∗ ′ = m i ∗ ] ⋅ Pr [ F wins ] ≥ 2 1 ⋅ l 1 ⋅ Pr [ F wins ] = 2 l 1 Pr [ F wins ] 于是,如果 OWF 存在,则 Lamport 单次签名有 OT-UF-CMA 性质。
💡
【定理】 如果
f f f 是一个单向置换 (One-Way Permutation, OWP),那么 Lamport 的构造就具有强单次不可伪造性。
【说明】 OWP 需要是双射,因此每个 m m m 只能对应唯一一个签名 σ \sigma σ ,所以如果 m = m ′ m=m' m = m ′ ,合法的签名 σ , σ ′ \sigma,\sigma' σ , σ ′ 一定满足 σ = σ ′ \sigma=\sigma' σ = σ ′ ,于是 ( m , σ ) = ( m ′ , σ ′ ) (m,\sigma)=(m',\sigma') ( m , σ ) = ( m ′ , σ ′ ) 。这也就自然说明了强不可伪造性。于是 Lamport 的构造具有强单次不可伪造性,具有 strong-OT-UF-CMA 安全。
通用单向哈希 (Universal One-Way Hash Function) . 考虑一族函数 H = { H : X → Y } \mathcal{H}=\{H:\mathcal{X}\rightarrow\mathcal{Y}\} H = { H : X → Y } ,该函数族是通用单向哈希当且仅当对于任意 PPT A \mathcal{A} A ,下面的概率(碰撞)是可忽略的:
Pr [ ( x , s ) ← A 1 ; H ← Gen ( 1 κ ) ; x ′ ← A 2 ( H , s ) : H ( x ) = H ( x ′ ) ∧ x ≠ x ′ ] = negl ( κ ) \begin{aligned}\text{Pr}\left[(x,s)\leftarrow \mathcal{A}_1;H\leftarrow\text{Gen}(1^\kappa);x'\leftarrow\mathcal{A}_2(H,s):H(x)=H(x')\wedge x\ne x'\right]=\text{negl}(\kappa)\end{aligned} Pr [ ( x , s ) ← A 1 ; H ← Gen ( 1 κ ) ; x ′ ← A 2 ( H , s ) : H ( x ) = H ( x ′ ) ∧ x = x ′ ] = negl ( κ ) 💡
如果
( Gen , H ) (\text{Gen},H) ( Gen , H ) 是一个通用单向哈希 (Universal One-Way Hash Function),那么将上述构造的
f f f 替换为
H s ( s ← Gen ) H_s(s\leftarrow\text{Gen}) H s ( s ← Gen ) 也具有 strong-OT-UF-CMA 安全。
说明 :因为如果伪造了签名 σ ≠ σ ′ \sigma\ne\sigma' σ = σ ′ 在某个位置 i i i 上不等,但消息 m i = m i ′ m_i=m_i' m i = m i ′ ,这就意味着 σ i ≠ σ i ′ \sigma_i\ne \sigma_i' σ i = σ i ′ 但
H ( σ i ) = y i , m i = y i , m i ′ = H ( σ i ′ ) H(\sigma_i)=y_{i,m_i}=y_{i,m_i'}=H(\sigma_i') H ( σ i ) = y i , m i = y i , m i ′ = H ( σ i ′ ) 与通用单向哈希的碰撞可忽略矛盾,因此,这样的构造仍然有 strong-OT-UF-CMA 安全。
说明 :即使有着多对一的 universal one-way hash function,只要碰撞的概率是可忽略的,这样够早的 Lamport 单次签名仍然有着 strong-OT-UF-CMA 安全。
隐藏比特模型下的非交互式零知识证明系统 (NIZK in the Hidden-Bits Model) . ( P , V ) (P,V) ( P , V ) . 对语言 L L L :
完备性 Completeness . ∀ x ∈ L ∩ { 0 , 1 } p 1 ( κ ) \forall x \in L\cap\{0,1\}^{p_1(\kappa)} ∀ x ∈ L ∩ { 0 , 1 } p 1 ( κ ) 以及 witness w x w_x w x :Pr [ r ← { 0 , 1 } p 2 ( κ ) , ( π , I ) ← P ( r , x , w x ) : V ( r I , x , π , I ) = 1 ] = 1 \text{Pr}[r\leftarrow\{0,1\}^{p_2(\kappa)},(\pi{\color{red},I})\leftarrow P(r,x,w_x):V(r_{\color{red}I},x,\pi{\color{red},I})=1]=1 Pr [ r ← { 0 , 1 } p 2 ( κ ) , ( π , I ) ← P ( r , x , w x ) : V ( r I , x , π , I ) = 1 ] = 1 这里的 I I I 是位置集合,即 Verifier 只能看到部分的 CRS(被 I I I 指定)。 自适应可靠性 Adaptive Soundness . ∀ P ~ \forall \tilde{P} ∀ P ~ (all powerful P ~ \tilde{P} P ~ ):Pr [ r ← { 0 , 1 } p 2 ( κ ) , ( x , π ~ , I ) ← P ~ ( 1 κ , r ) : V ( r I , x , π ~ , I ) = 1 ∧ x ∉ L ] = negl ( κ ) \begin{aligned}\text{Pr}[r\leftarrow\{0,1\}^{p_2(\kappa)},(x,\tilde{\pi}{\color{red},I})\leftarrow \tilde{P}(1^\kappa,r):V(r_{\color{red}I},x,\tilde{\pi}{\color{red},I})=1 \wedge x\notin L]=\text{negl}(\kappa)\end{aligned} Pr [ r ← { 0 , 1 } p 2 ( κ ) , ( x , π ~ , I ) ← P ~ ( 1 κ , r ) : V ( r I , x , π ~ , I ) = 1 ∧ x ∈ / L ] = negl ( κ ) 零知识 Zero-Knowledge . 存在一个 PPT 仿真器 Sim \text{Sim} Sim 使得 ∀ A \forall \mathcal{A} ∀ A ,下面分布是计算不可区分的。{ r ← { 0 , 1 } poly ( κ ) ; ( x ∈ L , w x ) ← A ( 1 κ ) ; ( π , I ) ← P ( r , x , w x ) : ( r I , x , π , I ) } ≈ c { ( x ∈ L , w x ) ← A ( 1 κ ) ; ( r ~ I , π ~ , I ) ← Sim ( x ) : ( r ~ I , x , π ~ , I ) } \begin{matrix}\{r\leftarrow\{0,1\}^{\text{poly}(\kappa)};(x\in L,w_x)\leftarrow\mathcal{A}(1^\kappa);(\pi{\color{red},I})\leftarrow P(r,x,w_x):(r_{\color{red}I},x,\pi{\color{red},I})\}\\\approx_c\\\{(x\in L,w_x)\leftarrow\mathcal{A}(1^\kappa);(\tilde{r}_{\color{red}I},\tilde{\pi}{\color{red},I})\leftarrow\text{Sim}(x):(\tilde{r}_{\color{red}I},x,\tilde{\pi}{\color{red},I})\}\end{matrix} { r ← { 0 , 1 } poly ( κ ) ; ( x ∈ L , w x ) ← A ( 1 κ ) ; ( π , I ) ← P ( r , x , w x ) : ( r I , x , π , I )} ≈ c {( x ∈ L , w x ) ← A ( 1 κ ) ; ( r ~ I , π ~ , I ) ← Sim ( x ) : ( r ~ I , x , π ~ , I )} 主要的思想其实就是限制 Verifier 所能看到的 CRS 范围的一个 NIZK。
用 NIZK in Hidden-Bits Model 构造 NIZK in CRS Model(正常的 NIZK) .
令 ( P ′ , V ′ ) (P',V') ( P ′ , V ′ ) 是一个 NIZK in Hidden-Bits Model,其 adaptive soundness error 为 2 − 2 κ 2^{-2\kappa} 2 − 2 κ 。 令 F = ( GenF , f , f − 1 ) F=(\text{GenF},f,f^{-1}) F = ( GenF , f , f − 1 ) 是一个 TDP,其中 h ( ⋅ ) h(\cdot) h ( ⋅ ) 是一个 hard-core bit。其中,hard-core bit 是 unbiased 的(如果原象均匀随机选,那么 hard-core bit 是 0 的概率和 1 的概率相等)。 很容易判断采函数取得的 f f f 是否是一个 GenF \text{GenF} GenF 的合理输出; 总共有 2 κ 2^\kappa 2 κ 个不同的 GenF \text{GenF} GenF 的输出 f f f 。 令 CRS 有 n κ n\kappa nκ 比特,分为 n n n 段如下 r = r 1 ∣ r 2 ∣ ⋯ ∣ r n ∈ { 0 , 1 } n κ r=r_1|r_2|\cdots|r_n\in\{0,1\}^{n\kappa} r = r 1 ∣ r 2 ∣ ⋯ ∣ r n ∈ { 0 , 1 } nκ ,其中 r i ∈ { 0 , 1 } κ r_i\in\{0,1\}^\kappa r i ∈ { 0 , 1 } κ 。 【构造方法】
π ← P ( 1 κ , r , x , w x ) \pi\leftarrow P(1^\kappa,r,x,w_x) π ← P ( 1 κ , r , x , w x ) .( f , f − 1 ) ← GenF ( 1 κ ) (f,f^{-1})\leftarrow\text{GenF}(1^\kappa) ( f , f − 1 ) ← GenF ( 1 κ ) 采样一个 TDP;r i ′ = h ( f − 1 ( r i ) ) , i ∈ [ n ] r_i'=h(f^{-1}(r_i)),i\in[n] r i ′ = h ( f − 1 ( r i )) , i ∈ [ n ] 求原象并求出 hardcore bit,总共得到均匀随机的 r ′ ∈ { 0 , 1 } n r'\in\{0,1\}^n r ′ ∈ { 0 , 1 } n (由 unbiased 保证均匀随机)。( π ′ , I ) ← P ′ ( r ′ , x , w x ) (\pi', I)\leftarrow P'(r',x,w_x) ( π ′ , I ) ← P ′ ( r ′ , x , w x ) 使用 hidden-bits model 下的 NIZK 的 Prover 给出 π ′ , I \pi', I π ′ , I ;π ← ( f , π ′ , I , ( f − 1 ( r i ) ) i ∈ I ) \pi\leftarrow(f,\pi',I,(f^{-1}(r_i))_{i\in I}) π ← ( f , π ′ , I , ( f − 1 ( r i ) ) i ∈ I ) Prove 中指包含了 i ∈ I i\in I i ∈ I 中的 r i r_i r i 的原象,其他地方不给出。{ 0 , 1 } ← V ( 1 κ , r , x , π ) \{0,1\}\leftarrow V(1^\kappa,r,x,\pi) { 0 , 1 } ← V ( 1 κ , r , x , π ) ,其中 π = ( f , π ′ , I , ( z i ) i ∈ I ) \pi=(f,\pi',I,(z_i)_{i\in I}) π = ( f , π ′ , I , ( z i ) i ∈ I ) .检查是否满足 r i = f ( z i ) , i ∈ I r_i=f(z_i), i\in I r i = f ( z i ) , i ∈ I ,否则返回 0; 令 r i ′ = h ( z i ) , i ∈ I r_i'=h(z_i), i \in I r i ′ = h ( z i ) , i ∈ I ,计算所有 I I I 中的 hard-core,即 r ′ r' r ′ ; 返回 V ′ ( 1 κ , r I ′ , x , π ′ , I ) V'(1^\kappa,r_I',x,\pi',I) V ′ ( 1 κ , r I ′ , x , π ′ , I ) 。 核心思想 :把除了 I I I 之外的其他 CRS(r i r_i r i 对应的象 r i ′ r_i' r i ′ )用 hard-core 保护起来,只提供 r I ′ r_I' r I ′ 给底层的 hidden-bits model NIZK。
💡
【证明】 Completeness :来源于底层的 Hidden-Bits Model NIZK 的 completeness,并且由 TDP 的正确性保证。
Adaptive Soundness :假设 s s s 是 V V V 中使用的随机数,令 Π ~ = ( f ~ , π ~ , I ~ , ( z ~ i ) i ∈ I ~ ) \tilde{\Pi}=(\tilde{f},\tilde{\pi},\tilde{I},(\tilde{z}_i)_{i\in\tilde{I}}) Π ~ = ( f ~ , π ~ , I ~ , ( z ~ i ) i ∈ I ~ ) 。
Pr r , s [ ( x , Π ~ ) ← P ~ ( 1 κ , r ) : V ( r , x , Π ~ ; s ) = 1 ∧ x ∈ { 0 , 1 } κ \ L ] = ∣ { ( r , s ) ∣ V ( r , x , Π ~ ; s ) = 1 ; x ∈ { 0 , 1 } κ \ L } ∣ ∣ R ∣ ⋅ ∣ S ∣ = ∑ f ~ ∈ F ∣ { ( r , s ) ∣ f ~ ∈ Π ~ ; V ( r , x , Π ~ ; s ) = 1 ; x ∉ L } ∣ ∣ R ∣ ⋅ ∣ S ∣ = ∑ f ~ ∈ F ∣ { ( r , s ) ∣ f ~ ∈ Π ~ ; f ~ valid ∧ ( f ~ ( z ~ i ) = r i ) i ∈ I ~ ∧ V ′ ( r I ′ , x , ( π ~ , I ~ ) ; s ) = 1 ; x ∉ L } ∣ ∣ R ∣ ⋅ ∣ S ∣ ≤ ∑ valid f ~ ∈ F ∣ { ( r , s ) ∣ ( f ~ ( z ~ i ) = r i ) i ∈ I ~ ∧ V ′ ( r I ′ , x , ( π ~ , I ~ ) ; s ) = 1 ; x ∉ L } ∣ ∣ R ∣ ⋅ ∣ S ∣ ≤ ∑ valid f ~ ∈ F ∣ { ( r , s ) ∣ V ′ ( r I ′ , x , ( π ~ , I ~ ) ; s ) = 1 ; x ∉ L } ∣ ∣ R ∣ ⋅ ∣ S ∣ ≤ 2 κ ⋅ 2 − 2 κ = 2 − κ = negl ( κ ) \small\begin{aligned}&\text{Pr}_{r,s}\left[(x,\tilde{\Pi})\leftarrow \tilde{P}(1^\kappa,r):V(r,x,\tilde{\Pi};s)=1\wedge x\in\{0,1\}^\kappa\backslash L\right]\\ =\ &\frac{\left|\{(r,s) \mid V(r,x,\tilde{\Pi};s)=1;x\in\{0,1\}^\kappa\backslash L\}\right|}{|\mathcal{R}|\cdot|\mathcal{S}|}\\ =\ &\sum_{\tilde{f}\in\mathcal{F}}\frac{\left|\{(r,s) \mid \tilde{f}\in\tilde{\Pi};V(r,x,\tilde{\Pi};s)=1;x\notin L\}\right|}{|\mathcal{R}|\cdot|\mathcal{S}|}\\=\ &\sum_{\tilde{f}\in\mathcal{F}}\frac{\left|\{(r,s) \mid \tilde{f}\in\tilde{\Pi};\tilde{f}\text{ valid}\wedge (\tilde{f}(\tilde{z}_i)=r_i)_{i\in \tilde{I}}\wedge V'(r_I',x,(\tilde{\pi},\tilde{I});s)=1;x\notin L\}\right|}{|\mathcal{R}|\cdot|\mathcal{S}|}\\\leq\ &\sum_{\text{valid }\tilde{f}\in\mathcal{F}}\frac{\left|\{(r,s) \mid (\tilde{f}(\tilde{z}_i)=r_i)_{i\in \tilde{I}}\wedge V'(r_I',x,(\tilde{\pi},\tilde{I});s)=1;x\notin L\}\right|}{|\mathcal{R}|\cdot|\mathcal{S}|}\\\leq\ &\sum_{\text{valid }\tilde{f}\in\mathcal{F}}\frac{\left|\{(r,s) \mid V'(r_I',x,(\tilde{\pi},\tilde{I});s)=1;x\notin L\}\right|}{|\mathcal{R}|\cdot|\mathcal{S}|} \\ \leq\ & 2^\kappa\cdot 2^{-2\kappa} \\ =\ &2^{-\kappa}=\text{negl}(\kappa)\end{aligned} = = = ≤ ≤ ≤ = Pr r , s [ ( x , Π ~ ) ← P ~ ( 1 κ , r ) : V ( r , x , Π ~ ; s ) = 1 ∧ x ∈ { 0 , 1 } κ \ L ] ∣ R ∣ ⋅ ∣ S ∣ ∣ ∣ {( r , s ) ∣ V ( r , x , Π ~ ; s ) = 1 ; x ∈ { 0 , 1 } κ \ L } ∣ ∣ f ~ ∈ F ∑ ∣ R ∣ ⋅ ∣ S ∣ ∣ ∣ {( r , s ) ∣ f ~ ∈ Π ~ ; V ( r , x , Π ~ ; s ) = 1 ; x ∈ / L } ∣ ∣ f ~ ∈ F ∑ ∣ R ∣ ⋅ ∣ S ∣ ∣ ∣ {( r , s ) ∣ f ~ ∈ Π ~ ; f ~ valid ∧ ( f ~ ( z ~ i ) = r i ) i ∈ I ~ ∧ V ′ ( r I ′ , x , ( π ~ , I ~ ) ; s ) = 1 ; x ∈ / L } ∣ ∣ valid f ~ ∈ F ∑ ∣ R ∣ ⋅ ∣ S ∣ ∣ ∣ {( r , s ) ∣ ( f ~ ( z ~ i ) = r i ) i ∈ I ~ ∧ V ′ ( r I ′ , x , ( π ~ , I ~ ) ; s ) = 1 ; x ∈ / L } ∣ ∣ valid f ~ ∈ F ∑ ∣ R ∣ ⋅ ∣ S ∣ ∣ ∣ {( r , s ) ∣ V ′ ( r I ′ , x , ( π ~ , I ~ ) ; s ) = 1 ; x ∈ / L } ∣ ∣ 2 κ ⋅ 2 − 2 κ 2 − κ = negl ( κ ) 第二行,我们运用古典概率,对构造中出现的随机数 r , s r,s r , s 进行计数后求出概率; 第三行,我们通过对 f ~ \tilde{f} f ~ 的值进行分类后对每个固定的 f ~ \tilde{f} f ~ 求和; 第四行,我们对于构造的 Verifier 的判定条件进行展开; 第五行,我们取消了对 f ~ ∈ Π ~ \tilde{f}\in\tilde{\Pi} f ~ ∈ Π ~ 的限制,允许所有 f ~ \tilde{f} f ~ ,不限于 P ~ \tilde{P} P ~ 构造出的那些 f ~ ∈ Π ~ \tilde{f}\in\tilde{\Pi} f ~ ∈ Π ~ ; 第六行,我们对条件进行放缩,不要求 f ~ ( z ~ i ) = r i , i ∈ I ~ \tilde{f}(\tilde{z}_i)=r_i,i\in \tilde{I} f ~ ( z ~ i ) = r i , i ∈ I ~ ; 第七行,我们可以看到这就是底层 Hidden-Bits Model NIZK 的 adaptive soundness; Zero Knowledge :我们已有一个 Hidden-Bits Model NIZK 的 Simulator,需要构造 CRS Model NIZK 的 Simulator。假设 Sim ′ \text{Sim}' Sim ′ 为 ( P ′ , V ′ ) (P',V') ( P ′ , V ′ ) 的 Simulator。
Simulator Real ( r I ′ , π , I ) ← Sim ′ ( 1 κ , x ) r ← { 0 , 1 } κ n ( f , f − 1 ) ← GenF ( 1 κ ) P ( 1 κ , r , x , w x ) { For i ∈ I ( f , f − 1 ) ← GenF ( 1 κ ) z i ← { 0 , 1 } κ s.t. h ( z i ) = r i ′ r i ′ = h ( f − 1 ( r i ) ) , i ∈ [ n ] r i = f ( z i ) ( π , I ) ← P ′ ( r ′ , x , w x ) For i ∉ I ( f , π ′ , I , ( f − 1 ( r i ) ) i ∈ I ) r i ← { 0 , 1 } κ } Return ( r 1 ∣ ⋯ ∣ r n , x , ( f , π , I , ( z i ) i ∈ I ) ) undefined ( 1 ) Return ( r , x , ( f , π ′ , I , ( f − 1 ( r i ) ) i ∈ I ) ) undefined ( 2 ) \begin{aligned}&\color{red}\textbf{Simulator} && \color{red}\textbf{Real}\\&(r_I',\pi,I)\leftarrow \text{Sim}'(1^\kappa,x) && r\leftarrow\{0,1\}^{\kappa n} \\&(f,f^{-1})\leftarrow\text{GenF}(1^\kappa) && P(1^\kappa,r,x,w_x) \ \{\\&\text{For } i \in I && \quad(f,f^{-1})\leftarrow\text{GenF}(1^\kappa)\\ &\quad z_i\leftarrow \{0,1\}^\kappa \text{ s.t. } h(z_i)=r_i'&&\quad r_i'=h(f^{-1}(r_i)),i\in[n]\\&\quad r_i=f(z_i) && \quad (\pi,I)\leftarrow P'(r',x,w_x)\\ &\text{For } i \notin I && \quad (f,\pi',I,(f^{-1}(r_i))_{i\in I})\\ & \quad r_i\leftarrow\{0,1\}^\kappa &&\}\\ &\text{Return }\underbrace{(r_1|\cdots|r_n,x,(f,\pi,I,(z_i)_{i\in I}))}_{(1)}&&\text{Return }\underbrace{(r,x,(f,\pi',I,(f^{-1}(r_i))_{i\in I}))}_{(2)}\end{aligned} Simulator ( r I ′ , π , I ) ← Sim ′ ( 1 κ , x ) ( f , f − 1 ) ← GenF ( 1 κ ) For i ∈ I z i ← { 0 , 1 } κ s.t. h ( z i ) = r i ′ r i = f ( z i ) For i ∈ / I r i ← { 0 , 1 } κ Return ( 1 ) ( r 1 ∣ ⋯ ∣ r n , x , ( f , π , I , ( z i ) i ∈ I )) Real r ← { 0 , 1 } κn P ( 1 κ , r , x , w x ) { ( f , f − 1 ) ← GenF ( 1 κ ) r i ′ = h ( f − 1 ( r i )) , i ∈ [ n ] ( π , I ) ← P ′ ( r ′ , x , w x ) ( f , π ′ , I , ( f − 1 ( r i ) ) i ∈ I ) } Return ( 2 ) ( r , x , ( f , π ′ , I , ( f − 1 ( r i ) ) i ∈ I )) 我们希望证明 ( 1 ) ≈ c ( 2 ) (1)\approx_c(2) ( 1 ) ≈ c ( 2 ) 。考虑使用 Hybrid Argument 方法插入 Hybrid 的 ( 1 ′ ) (1') ( 1 ′ ) :
Simulator Hybrid ( r I ′ , π , I ) ← Sim ′ ( 1 κ , x ) r ′ ← { 0 , 1 } n ; ( π , I ) ← P ′ ( 1 κ , r ′ , x , w x ) ( f , f − 1 ) ← GenF ( 1 κ ) ( f , f − 1 ) ← GenF ( 1 κ ) For i ∈ I For i ∈ I z i ← { 0 , 1 } κ s.t. h ( z i ) = r i ′ z i ← { 0 , 1 } κ s.t. h ( z i ) = r i ′ r i = f ( z i ) r i = f ( z i ) For i ∉ I For i ∉ I r i ← { 0 , 1 } κ r i ← { 0 , 1 } κ Return ( r 1 ∣ ⋯ ∣ r n , x , ( f , π , I , ( z i ) i ∈ I ) ) undefined ( 1 ) Return ( r 1 ∣ ⋯ ∣ r n , x , ( f , π , I , ( z i ) i ∈ I ) ) undefined ( 1 ′ ) \begin{aligned}&\color{red}\textbf{Simulator} && \color{red}\textbf{Hybrid}\\&(r_I',\pi,I)\leftarrow \text{Sim}'(1^\kappa,x) && r'\leftarrow\{0,1\}^n;(\pi,I)\leftarrow P'(1^\kappa,r',x,w_x) \\&(f,f^{-1})\leftarrow\text{GenF}(1^\kappa) && (f,f^{-1})\leftarrow\text{GenF}(1^\kappa) \\&\text{For } i \in I && \text{For } i \in I \\ &\quad z_i\leftarrow \{0,1\}^\kappa \text{ s.t. } h(z_i)=r_i'&&\quad z_i\leftarrow \{0,1\}^\kappa \text{ s.t. } h(z_i)=r_i'\\&\quad r_i=f(z_i) && \quad r_i=f(z_i)\\ &\text{For } i \notin I && \text{For } i \notin I\\ & \quad r_i\leftarrow\{0,1\}^\kappa &&\quad r_i\leftarrow\{0,1\}^\kappa\\ &\text{Return }\underbrace{(r_1|\cdots|r_n,x,(f,\pi,I,(z_i)_{i\in I}))}_{(1)}&&\text{Return }\underbrace{(r_1|\cdots|r_n,x,(f,\pi,I,(z_i)_{i\in I}))}_{(1')}\end{aligned} Simulator ( r I ′ , π , I ) ← Sim ′ ( 1 κ , x ) ( f , f − 1 ) ← GenF ( 1 κ ) For i ∈ I z i ← { 0 , 1 } κ s.t. h ( z i ) = r i ′ r i = f ( z i ) For i ∈ / I r i ← { 0 , 1 } κ Return ( 1 ) ( r 1 ∣ ⋯ ∣ r n , x , ( f , π , I , ( z i ) i ∈ I )) Hybrid r ′ ← { 0 , 1 } n ; ( π , I ) ← P ′ ( 1 κ , r ′ , x , w x ) ( f , f − 1 ) ← GenF ( 1 κ ) For i ∈ I z i ← { 0 , 1 } κ s.t. h ( z i ) = r i ′ r i = f ( z i ) For i ∈ / I r i ← { 0 , 1 } κ Return ( 1 ′ ) ( r 1 ∣ ⋯ ∣ r n , x , ( f , π , I , ( z i ) i ∈ I )) 我们知道根据 Hidden-Bits Model NIZK 的 Zero Knowledge 性质,有 ( 1 ) ≈ c ( 1 ′ ) (1)\approx_c(1') ( 1 ) ≈ c ( 1 ′ ) 。
Hybrid Real r ′ ← { 0 , 1 } n ; ( π , I ) ← P ′ ( 1 κ , r ′ , x , w x ) r ← { 0 , 1 } κ n ( f , f − 1 ) ← GenF ( 1 κ ) P ( 1 κ , r , x , w x ) { For i ∈ I ( f , f − 1 ) ← GenF ( 1 κ ) z i ← { 0 , 1 } κ s.t. h ( z i ) = r i ′ r i ′ = h ( f − 1 ( r i ) ) , i ∈ [ n ] r i = f ( z i ) ( π , I ) ← P ′ ( r ′ , x , w x ) For i ∉ I ( f , π ′ , I , ( f − 1 ( r i ) ) i ∈ I ) r i ← { 0 , 1 } κ } Return ( r 1 ∣ ⋯ ∣ r n , x , ( f , π , I , ( z i ) i ∈ I ) ) undefined ( 1 ′ ) Return ( r , x , ( f , π ′ , I , ( f − 1 ( r i ) ) i ∈ I ) ) undefined ( 2 ) \begin{aligned}&\color{red}\textbf{Hybrid} && \color{red}\textbf{Real}\\&r'\leftarrow\{0,1\}^n;(\pi,I)\leftarrow P'(1^\kappa,r',x,w_x) && r\leftarrow\{0,1\}^{\kappa n} \\&(f,f^{-1})\leftarrow\text{GenF}(1^\kappa) && P(1^\kappa,r,x,w_x) \ \{\\&\text{For } i \in I && \quad(f,f^{-1})\leftarrow\text{GenF}(1^\kappa)\\ &\quad z_i\leftarrow \{0,1\}^\kappa \text{ s.t. } h(z_i)=r_i'&&\quad r_i'=h(f^{-1}(r_i)),i\in[n]\\&\quad r_i=f(z_i) && \quad (\pi,I)\leftarrow P'(r',x,w_x)\\ &\text{For } i \notin I && \quad (f,\pi',I,(f^{-1}(r_i))_{i\in I})\\ & \quad r_i\leftarrow\{0,1\}^\kappa &&\}\\ &\text{Return }\underbrace{(r_1|\cdots|r_n,x,(f,\pi,I,(z_i)_{i\in I}))}_{(1')}&&\text{Return }\underbrace{(r,x,(f,\pi',I,(f^{-1}(r_i))_{i\in I}))}_{(2)}\end{aligned} Hybrid r ′ ← { 0 , 1 } n ; ( π , I ) ← P ′ ( 1 κ , r ′ , x , w x ) ( f , f − 1 ) ← GenF ( 1 κ ) For i ∈ I z i ← { 0 , 1 } κ s.t. h ( z i ) = r i ′ r i = f ( z i ) For i ∈ / I r i ← { 0 , 1 } κ Return ( 1 ′ ) ( r 1 ∣ ⋯ ∣ r n , x , ( f , π , I , ( z i ) i ∈ I )) Real r ← { 0 , 1 } κn P ( 1 κ , r , x , w x ) { ( f , f − 1 ) ← GenF ( 1 κ ) r i ′ = h ( f − 1 ( r i )) , i ∈ [ n ] ( π , I ) ← P ′ ( r ′ , x , w x ) ( f , π ′ , I , ( f − 1 ( r i ) ) i ∈ I ) } Return ( 2 ) ( r , x , ( f , π ′ , I , ( f − 1 ( r i ) ) i ∈ I )) 在 Hybrid 中 r i ′ ⇒ r i ( i ∈ I ) ; r j ← { 0 , 1 } κ ( j ∉ I ) r_i'\Rightarrow r_i (i\in I); r_j\leftarrow\{0,1\}^\kappa (j\notin I) r i ′ ⇒ r i ( i ∈ I ) ; r j ← { 0 , 1 } κ ( j ∈ / I ) ; 在 Real 中 r i ⇒ r i ′ r_i\Rightarrow r_i' r i ⇒ r i ′ 根据 Hard-core 的定义,难以区分均匀随机和 hard-core bit,因此 ( 1 ′ ) ≈ c ( 2 ) (1')\approx_c (2) ( 1 ′ ) ≈ c ( 2 ) 。我们形式化地将规约写出:
C ′ A ′ / C A β ← { 0 , 1 } r ′ ← { 0 , 1 } n ( f , f − 1 ) ← GenF ( 1 κ ) ( π , I ) ← P ′ ( r ′ , x , w x ) For j = 1 to l n { x j ← { 0 , 1 } κ ; y j = f ( x j ) if β = 0 then b j ← { 0 , 1 } else b j = h ( x j ) } ⟶ f , ( y j , b j ) j ∈ [ l n ] t 0 / 1 : = ∣ { b j ∣ b j = 0 / 1 , j ∈ [ l n ] } ∣ if t 0 < n or t 1 < n then abort For i ∈ [ n ] \ I { match r i ′ = b j = 0 set r i = y j match r i ′ = b j = 1 set r i = y j } For i ∈ I { z i ← { 0 , 1 } κ s.t. h ( z i ) = r i ′ r i = f ( z i ) } r ′ = r [ n ] \ I ′ ∪ r I ′ ; r = r 1 ∣ r 2 ∣ ⋯ ∣ r n π ′ = ( f , π , I , ( z i ) i ∈ I ) ⟶ ( r , x , π ′ ) ⟵ β ′ ⟵ β ′ \color{darkblue}\small\begin{matrix}\mathcal{C'}& &\mathcal{A'/C} & &\mathcal{A}\\ \beta\leftarrow \{0,1\} & & r'\leftarrow\{0,1\}^n \\(f,f^{-1})\leftarrow\text{GenF}(1^\kappa) & &(\pi,I)\leftarrow P'(r',x,w_x)\\ \text{For }j=1\text{ to }ln \quad \\ \scriptsize\left\{\begin{matrix}x_j\leftarrow\{0,1\}^\kappa;y_j=f(x_j)\\ \text{if } \beta=0 \text{ then } b_j\leftarrow\{0,1\} \\ \text{else } b_j=h(x_j)\end{matrix}\right\} & \stackrel{f,(y_j,b_j)_{j\in[ln]}}\longrightarrow \\ & & t_{0/1}:=|\{b_j|b_j=0/1,j\in[ln]\}|\\ & & \text{if } t_0<n \text{ or } t_1<n \text{ then abort}\\ & & \text{For } i\in[n]\backslash I \\ & & \scriptsize \left\{\begin{matrix}\text{match } r_i'=b_j=0\text{ set } r_i=y_j\\\text{match } r_i'=b_j=1\text{ set } r_i=y_j\end{matrix}\right\}\\ & & \text{For }i\in I \\ & & \scriptsize\left\{\begin{matrix}z_i\leftarrow\{0,1\}^\kappa\text{ s.t. } h(z_i)=r_i' \\ r_i=f(z_i)\end{matrix}\right\}\\ & & r'=r'_{[n]\backslash I}\cup r'_{I}; \\ & & r = r_1|r_2|\cdots|r_n\\ & & \pi'=(f,\pi,I,(z_i)_{i\in I}) \\ & & &\stackrel{(r,x,\pi')}{\longrightarrow} \\ &\stackrel{\beta'}{\longleftarrow} & & \stackrel{\beta'}{\longleftarrow}\end{matrix} C ′ β ← { 0 , 1 } ( f , f − 1 ) ← GenF ( 1 κ ) For j = 1 to l n { x j ← { 0 , 1 } κ ; y j = f ( x j ) if β = 0 then b j ← { 0 , 1 } else b j = h ( x j ) } ⟶ f , ( y j , b j ) j ∈ [ l n ] ⟵ β ′ A ′ / C r ′ ← { 0 , 1 } n ( π , I ) ← P ′ ( r ′ , x , w x ) t 0/1 := ∣ { b j ∣ b j = 0/1 , j ∈ [ l n ]} ∣ if t 0 < n or t 1 < n then abort For i ∈ [ n ] \ I { match r i ′ = b j = 0 set r i = y j match r i ′ = b j = 1 set r i = y j } For i ∈ I { z i ← { 0 , 1 } κ s.t. h ( z i ) = r i ′ r i = f ( z i ) } r ′ = r [ n ] \ I ′ ∪ r I ′ ; r = r 1 ∣ r 2 ∣ ⋯ ∣ r n π ′ = ( f , π , I , ( z i ) i ∈ I ) ⟶ ( r , x , π ′ ) ⟵ β ′ A 在上面的规约中 β = 0 \beta=0 β = 0 模拟的是 Hybrid,而 β = 1 \beta=1 β = 1 模拟的是 Real。如果 A \mathcal{A} A 可以以不可忽略的概率差区分 Hybrid 和 Real,我们可以构造 A ′ \mathcal{A}' A ′ ,其解决 l n ln l n 个 TDP hard-core bit 问题的概率不可忽略,即
∣ Pr [ A ( 1 ′ ) = 1 ] − Pr [ A ( 2 ) = 1 ] ∣ = ∣ Pr [ β ′ = 1 ∣ β = 0 ] − Pr [ β ′ = 1 ∣ β = 0 ] ∣ ≤ l n ⋅ Adv PKE , A ′ Hard-Core 2 ( κ ) ≤ l n ⋅ negl ( κ ) = negl ( κ ) \begin{aligned}\left|\text{Pr}[\mathcal{A}(1')=1]-\text{Pr}[\mathcal{A}(2)=1]\right| &=\left|\text{Pr}[\beta'=1|\beta=0] - \text{Pr}[\beta'=1|\beta=0]\right|\\ &\leq ln\cdot\textbf{Adv}_{\text{PKE},\mathcal{A}'}^{\text{Hard-Core 2}}(\kappa) \\ &\leq ln\cdot\text{negl}(\kappa) \\ &=\text{negl}(\kappa)\end{aligned} ∣ Pr [ A ( 1 ′ ) = 1 ] − Pr [ A ( 2 ) = 1 ] ∣ = ∣ Pr [ β ′ = 1∣ β = 0 ] − Pr [ β ′ = 1∣ β = 0 ] ∣ ≤ l n ⋅ Adv PKE , A ′ Hard-Core 2 ( κ ) ≤ l n ⋅ negl ( κ ) = negl ( κ ) 因此 ( 1 ) ≈ c ( 2 ) (1)\approx_c(2) ( 1 ) ≈ c ( 2 ) ,即该构造具有 ZK 性质。
对于任意 NP 语言 L L L 的 Hidden-Bits Model NIZK .
💡
Cook-Levin Reduction . 假设
L ∗ L^* L ∗ 是一个 NPC 语言,对于任意 NP 语言
L L L ,存在一个多项式时间计算的函数
f f f 满足
x ∈ L ⟹ f ( x ) ∈ L ∗ x\in L\Longrightarrow f(x)\in L^* x ∈ L ⟹ f ( x ) ∈ L ∗ ;同时存在一个多项式时间计算的函数
f ′ f' f ′ 满足如果
w x w_x w x 是
x ∈ L x\in L x ∈ L 的 witness,那么
f ′ ( w x ) f'(w_x) f ′ ( w x ) 是
f ( x ) ∈ L ∗ f(x)\in L^* f ( x ) ∈ L ∗ 的 witness。
💡
命题 . 如果存在一个针对 NPC 语言
L ∗ L^* L ∗ 的 (a)NIZK
( P ∗ , V ∗ ) (P^*,V^*) ( P ∗ , V ∗ ) ,那么对于任意 NP 语言
L L L ,存在一个
( P , V ) (P,V) ( P , V ) 的 (a)NIZK。
【证明】 给定 x ∈ L x\in L x ∈ L ,我们只需要以 f ( x ) , f ′ ( w x ) f(x),f'(w_x) f ( x ) , f ′ ( w x ) 为输入调用 ( P ∗ , V ∗ ) (P^*,V^*) ( P ∗ , V ∗ ) 即可。
因此,我们寻找一个特定的 NPC 语言,构造出其的 Hidden-Bits Model NIZK 即可。我们选择有向图的哈密尔顿回路 作为该 NPC 语言 L ∗ L^* L ∗ ,即
L ∗ = { G = ( V , E ) ∣ directed graph G which contains at least one Hamiltonian cycle } \begin{aligned}L^*=\{G=(V,E)|\text{directed graph $G$ which contains at least one Hamiltonian cycle}\}\end{aligned} L ∗ = { G = ( V , E ) ∣ directed graph G which contains at least one Hamiltonian cycle } 一些基本定义:
排列矩阵 (Permutation Matrix) :n × n n\times n n × n 的方阵,每行每列只有 1 个 1;共有 n ! n! n ! 个排列矩阵。哈密尔顿矩阵 (Hamiltonian Matrix) :一个特殊的排列矩阵,在图 G G G 中对应一个哈密尔顿环;假设图 G G G 为完全图,那么共有 ( n − 1 ) ! (n-1)! ( n − 1 )! 个排列矩阵。Useful Matrix :n 3 × n 3 n^3\times n^3 n 3 × n 3 的矩阵,其中存在一个 n × n n\times n n × n 的哈密尔顿矩阵,其他部分是 0。Modified Hidden-Bits Model NIZK for L ∗ L^* L ∗ .
输入:有向图 G = ( V , E ) G=(V,E) G = ( V , E ) ,其中 n n n 为安全参数,令 M G M_G M G 为 G G G 的邻接矩阵; 修改: r ∈ { 0 , 1 } n 2 r\in\{0,1\}^{n^2} r ∈ { 0 , 1 } n 2 ,但不是均匀随机的,而是一个随机哈密尔顿矩阵 C C C 。 后续我们会撤销这个修改,变成真正的 Hidden-Bits Model NIZK;这个修改只是让当前版本好理解而已。 Witness W W W :图 G G G 的一个哈密尔顿圈子图,用来验证图 G G G 是否是一个哈密尔顿图。 P ∗ ( r , G , W ) P^*(r,G,W) P ∗ ( r , G , W ) :选择一个排列 π \pi π 将 W W W 映射成 C C C (同构) ,返回 proof ( r I , I , π ) (r_I, I, \pi) ( r I , I , π ) 。这里,我们令 I = { ( π ( i ) , π ( j ) ) : M C ( π ( i ) , π ( j ) ) = 0 , M π ( E ) ( π ( i ) , π ( j ) ) = 0 } I=\{(\pi(i),\pi(j)):M_C(\pi(i),\pi(j))=0, M_{\pi(E)}(\pi(i),\pi(j))=0\} I = {( π ( i ) , π ( j )) : M C ( π ( i ) , π ( j )) = 0 , M π ( E ) ( π ( i ) , π ( j )) = 0 } 且 r I = 00 ⋯ 0 r_I = 00\cdots 0 r I = 00 ⋯ 0 。我们将节点映射至图 C C C 上,I I I 中包含了图 C C C 中没有边、同时在同构图 π ( E ) \pi(E) π ( E ) 中也不存在边的节点对。 V ∗ ( r I , I , G , π ) V^*(r_I, I, G, \pi) V ∗ ( r I , I , G , π ) :验证 π \pi π 是否是一个排列,同时 ∀ ( π ( i ) , π ( j ) ) ∉ π ( E ) \forall (\pi(i),\pi(j))\notin \pi(E) ∀ ( π ( i ) , π ( j )) ∈ / π ( E ) ,需要满足 ( π ( i ) , π ( j ) ) ∈ I (\pi(i),\pi(j))\in I ( π ( i ) , π ( j )) ∈ I 且 M C ( π ( i ) , π ( j ) ) = 0 M_C(\pi(i),\pi(j))=0 M C ( π ( i ) , π ( j )) = 0 。即验证在同构图中不存在边的节点对是否满足在 I I I 中,且在 C C C 中也没有边相连。 💡
Completeness . 若
G ∈ L ∗ G\in L^* G ∈ L ∗ 且
π \pi π 是一个排列,那么若
M π ( E ) ( π ( i ) , π ( j ) ) = 0 M_{\pi(E)}(\pi(i),\pi(j))=0 M π ( E ) ( π ( i ) , π ( j )) = 0 ,那么
M C ( π ( i ) , π ( j ) ) = 0 M_C(\pi(i),\pi(j))=0 M C ( π ( i ) , π ( j )) = 0 。
Perfect Adaptive Soundness . 若 V ∗ ( r I , G , π ) = 1 V^*(r_I,G,\pi)=1 V ∗ ( r I , G , π ) = 1 ,那么 G G G 一定有哈密尔顿圈。
反证,若没有哈密尔顿圈,一定有一个缺口,在同构图中是 0,但是在图 C C C 中是 1;这个缺口边没法满足条件。 由于 soundness 是 perfect 的,自然是 soundness 的。 Perfect Zero Knowledge . 存在一个仿真器 SIM ( 1 κ , G = ( V , E ) ) → ( r I , π , I ) \text{SIM}(1^\kappa,G=(V,E))\rightarrow(r_I,\pi,I) SIM ( 1 κ , G = ( V , E )) → ( r I , π , I ) :随机选择一个排列 π \pi π ,令 I = { ( π ( i ) , π ( j ) ) : M π ( E ) ( π ( i ) , π ( j ) ) = 0 } I=\{(\pi(i),\pi(j)):M_{\pi(E)}(\pi(i),\pi(j))=0\} I = {( π ( i ) , π ( j )) : M π ( E ) ( π ( i ) , π ( j )) = 0 } ,令 r I = 00 ⋯ 0 r_I=00\cdots 0 r I = 00 ⋯ 0 ,返回 ( r I , π , I ) (r_I, \pi, I) ( r I , π , I ) 即可。
从 Modified Hidden-Bits Model NIZK 到 Hidden-Bits Model NIZK . 下面,我们需要用 Modified Hidden-Bits Model NIZK 来构造 Hidden-Bits Model NIZK。
🔑
从 Unbiased Bits 构造 Biased Bits . 令
s ← { 0 , 1 } 5 log 2 n s\leftarrow\{0,1\}^{5\log_2 n} s ← { 0 , 1 } 5 l o g 2 n ,若
s = 11 ⋯ 1 s=11\cdots1 s = 11 ⋯ 1 ,令
b = 1 b=1 b = 1 ;否则
b = 0 b=0 b = 0 。那么
Pr [ b = 1 ] = n − 5 \text{Pr}[b=1]=n^{-5} Pr [ b = 1 ] = n − 5 ,且
Pr [ b = 0 ] = 1 − n − 5 \text{Pr}[b=0]=1-n^{-5} Pr [ b = 0 ] = 1 − n − 5 。
构造 Useful Matrix .
构造一个长度为 n 6 n^6 n 6 的 biased bits 字符串 S S S ,其中 biased probability 为 n − 5 n^{-5} n − 5 (见上); 将 S S S 看成一个 n 3 × n 3 n^3\times n^3 n 3 × n 3 的矩阵 M M M ; 如果 M M M 是 useful matrix,输出 M M M ,否则输出 ⊥ \perp ⊥ 。 💡
构造出 Useful Matrix 的概率 Pr [ M is useful ] = Ω ( n − 2 ) \text{Pr}[M\text{ is useful}]=\Omega\left(n^{-2}\right) Pr [ M is useful ] = Ω ( n − 2 ) 【证明】
定义事件:
A A A : M M M 包含正好 n n n 个 1;B B B : M M M 包含一个 n × n n\times n n × n 子矩阵是排列矩阵;C C C : M M M 包含一个 n × n n\times n n × n 子矩阵是哈密尔顿矩阵,即等价于 M M M 是 useful matrix。另外注意到 C = C ∧ B ∧ A C = C \wedge B \wedge A C = C ∧ B ∧ A 。那么,首先考虑 Pr [ A ] \text{Pr}[A] Pr [ A ] 。令 X X X 是一个计算 M M M 中 1 的个数的随机变量,那么
E [ X ] = n − 5 n 6 = n , Var [ X ] = n − 5 ( 1 − n − 5 ) n 6 = n − n − 4 < n \mathbb{E}[X]=n^{-5}n^6=n,\quad \text{Var}[X]=n^{-5}(1-n^{-5})n^6=n-n^{-4}<n E [ X ] = n − 5 n 6 = n , Var [ X ] = n − 5 ( 1 − n − 5 ) n 6 = n − n − 4 < n 根据切比雪夫不等式,
Pr [ ∣ X − E [ X ] ∣ ≥ k ] ≤ Var ( X ) k 2 \text{Pr}[\left|X-\mathbb{E}[X]\right|\ge k] \leq \frac{\text{Var}(X)}{k^2} Pr [ ∣ X − E [ X ] ∣ ≥ k ] ≤ k 2 Var ( X ) 令 k = n k=n k = n ,代入结果有
Pr [ ∣ X − n ∣ ≥ n ] ≤ n n 2 = 1 n \text{Pr}[|X-n|\ge n] \leq \frac{n}{n^2}=\frac{1}{n} Pr [ ∣ X − n ∣ ≥ n ] ≤ n 2 n = n 1 于是,
∑ i = 1 2 n − 1 Pr [ X = i ] ≥ 1 − 1 n \sum_{i=1}^{2n-1}\text{Pr}[X=i]\ge 1-\frac{1}{n} i = 1 ∑ 2 n − 1 Pr [ X = i ] ≥ 1 − n 1 于是,根据 Bernoulli 分布的形式,在均值 X = n X=n X = n 处概率最大,于是
Pr [ A ] = Pr [ X = n ] ≥ ∑ i = 1 2 n − 1 Pr [ X = i ] 2 n − 1 = 1 − n − 1 2 n − 1 ≥ ( n ≥ 3 ) 1 3 n = Ω ( n − 1 ) \text{Pr}[A]=\text{Pr}[X=n]\ge\frac{\sum_{i=1}^{2n-1}\text{Pr}[X=i]}{2n-1} = \frac{1-n^{-1}}{2n-1} \stackrel{(n\ge 3)}{\ge} \frac{1}{3n} = \Omega(n^{-1}) Pr [ A ] = Pr [ X = n ] ≥ 2 n − 1 ∑ i = 1 2 n − 1 Pr [ X = i ] = 2 n − 1 1 − n − 1 ≥ ( n ≥ 3 ) 3 n 1 = Ω ( n − 1 ) 接着考虑 Pr [ B ∣ A ] \text{Pr}[B|A] Pr [ B ∣ A ] 。矩阵里有 n 6 n^6 n 6 个位置,要挑 n n n 个放 1,总方案数是 C n 6 n C_{n^6}^n C n 6 n ;但我要保证有一个排列矩阵,因此每行每列最多只有 1 个 1,因此从 n 3 n^3 n 3 行 n 3 n^3 n 3 列(独立)分别挑出 n n n 行 n n n 列,方案数即为 C n 3 n ⋅ C n 3 n C_{n^3}^n \cdot C_{n^3}^n C n 3 n ⋅ C n 3 n ;此外,因为是排列,所以每 n n n 行 n n n 列对应着 n ! n! n ! 个具体排列方案,因此:
Pr [ B ∣ A ] = C n 3 n ⋅ C n 3 n ⋅ n ! C n 6 n ≈ Ω ( 1 ) \text{Pr}[B|A]=\frac{C_{n^3}^n \cdot C_{n^3}^n\cdot n!}{C_{n^6}^n} \approx \Omega(1) Pr [ B ∣ A ] = C n 6 n C n 3 n ⋅ C n 3 n ⋅ n ! ≈ Ω ( 1 ) 另一方面,给定一个正好有 n n n 个 1 的矩阵 M M M ,每行至少有 2 个 1 的概率为:
1 − ( 1 − 1 n 3 ) n undefined no 1 in this line − n ⋅ 1 n 3 ⋅ ( 1 − 1 n 3 ) n − 1 undefined only one 1 in this line ≈ 2 n − 1 n 5 1-\underbrace{\left(1-\frac{1}{n^3}\right)^n}_{\text{no 1 in this line}}-\underbrace{n\cdot\frac{1}{n^3}\cdot \left(1-\frac{1}{n^3}\right)^{n-1}}_{\text{only one 1 in this line}}\approx\frac{2n-1}{n^5} 1 − no 1 in this line ( 1 − n 3 1 ) n − only one 1 in this line n ⋅ n 3 1 ⋅ ( 1 − n 3 1 ) n − 1 ≈ n 5 2 n − 1 总共有 n 3 + n 3 n^3+n^3 n 3 + n 3 个行列,因此存在一行/列含有至少 2 个 1 的概率为:
2 n 3 ⋅ 2 n − 1 n 5 = O ( n − 1 ) 2n^3 \cdot \frac{2n-1}{n^5} = O(n^{-1}) 2 n 3 ⋅ n 5 2 n − 1 = O ( n − 1 ) 因此,存在一个排列矩阵的概率即为不存在一行/列含有至少 2 个 1 的概率:
Pr [ B ∣ A ] = 1 − O ( n − 1 ) = Ω ( 1 ) \text{Pr}[B|A]=1-O(n^{-1})=\Omega(1) Pr [ B ∣ A ] = 1 − O ( n − 1 ) = Ω ( 1 ) 对于 Pr [ C ∣ B ] \text{Pr}[C|B] Pr [ C ∣ B ] ,则是一个古典概率计数问题,即
Pr [ C ∣ B ] = Pr [ M is a Hamiltonian matrix] Pr [ M is a permutation matrix ] = ( n − 1 ) ! n ! = 1 n = Ω ( n − 1 ) \text{Pr}[C|B]=\frac{\text{Pr}[\text{$M$ is a Hamiltonian matrix]}}{\text{Pr}[\text{$M$ is a permutation matrix}]}=\frac{(n-1)!}{n!}=\frac{1}{n}=\Omega(n^{-1}) Pr [ C ∣ B ] = Pr [ M is a permutation matrix ] Pr [ M is a Hamiltonian matrix] = n ! ( n − 1 )! = n 1 = Ω ( n − 1 ) 综上所述,
Pr [ C ] = Pr [ C ∧ B ∧ A ] = Pr [ A ] Pr [ B ∣ A ] Pr [ C ∣ B , A ] = Pr [ A ] Pr [ B ∣ A ] Pr [ C ∣ B ] = Ω ( n − 1 ) ⋅ Ω ( 1 ) ⋅ Ω ( n − 1 ) = Ω ( n − 2 ) \begin{aligned}\text{Pr}[C]&=\text{Pr}[C\wedge B\wedge A]\\&=\text{Pr}[A]\text{Pr}[B|A]\text{Pr}[C|B,A]\\&=\text{Pr}[A]\text{Pr}[B|A]\text{Pr}[C|B]\\&=\Omega(n^{-1})\cdot \Omega(1)\cdot \Omega(n^{-1})\\ &=\Omega(n^{-2})\end{aligned} Pr [ C ] = Pr [ C ∧ B ∧ A ] = Pr [ A ] Pr [ B ∣ A ] Pr [ C ∣ B , A ] = Pr [ A ] Pr [ B ∣ A ] Pr [ C ∣ B ] = Ω ( n − 1 ) ⋅ Ω ( 1 ) ⋅ Ω ( n − 1 ) = Ω ( n − 2 ) 这个结论说明了,平均采样 n 2 n^2 n 2 个矩阵,即可采样出一个 Useful Matrix,因此 存在一个多项式时间的采样算法得到 Useful Matrix 。
Hidden-Bits Model NIZK for L ∗ ∈ NPC L^*\in\text{NPC} L ∗ ∈ NPC .
输入 :有向图 G = ( V , E ) G=(V,E) G = ( V , E ) ,其中 ∣ V ∣ = n |V|=n ∣ V ∣ = n 且 n n n 为安全参数,令 M G M_G M G 为 G G G 的邻接矩阵。Hidden-Bits String . r ∈ { 0 , 1 } n 3 ⋅ ( n 3 ⋅ n 3 ) ⋅ 5 log 2 n r\in\{0,1\}^{n^3\cdot(n^3\cdot n^3)\cdot 5\log_2 n} r ∈ { 0 , 1 } n 3 ⋅ ( n 3 ⋅ n 3 ) ⋅ 5 l o g 2 n ,并解析成 n 3 n^3 n 3 个矩阵 M 1 , ⋯ , M n 3 M_1,\cdots,M_{n^3} M 1 , ⋯ , M n 3 ;该过程写作 ( M 1 , ⋯ , M n 3 ) ← SamMatrix ( r ) (M_1,\cdots,M_{n^3})\leftarrow\text{SamMatrix}(r) ( M 1 , ⋯ , M n 3 ) ← SamMatrix ( r ) 。P ∗ ( r , G , W ) P^*(r,G,W) P ∗ ( r , G , W ) : ( M 1 , ⋯ , M n 3 ) ← SamMatrix ( r ) (M_1,\cdots,M_{n^3})\leftarrow\text{SamMatrix}(r) ( M 1 , ⋯ , M n 3 ) ← SamMatrix ( r ) ,对每个 M k ( k ∈ [ n 3 ] ) M_k\ (k\in[n^3]) M k ( k ∈ [ n 3 ]) :如果 M k M_k M k 不是 useful matrix,直接公开 M k M_k M k 至 r I r_I r I 中; 如果 M k M_k M k 是 useful matrix,令 C k C_k C k 为其中的 n × n n\times n n × n 的汉密尔顿子矩阵,公开剩下的 n 6 − n 2 n^6-n^2 n 6 − n 2 个空白单元至 r I r_I r I 中; 对每个 useful matrix M k M_k M k ,选一个排列 π k \pi_k π k 可以将 W W W 映射成 C k C_k C k 并公开以下内容至 r I r_I r I 中:{ M C ( π k ( i ) , π k ( j ) ) : M C ( π k ( i ) , π k ( j ) ) = 0 , M E ( i , j ) = 0 } \{M_C(\pi_k(i),\pi_k(j)):M_C(\pi_k(i),\pi_k(j))=0, M_E(i,j)=0\} { M C ( π k ( i ) , π k ( j )) : M C ( π k ( i ) , π k ( j )) = 0 , M E ( i , j ) = 0 } 返回 Π = ( I , r I = 00 ⋯ 0 , ( π k ) M k is useful ) \Pi=(I,r_I=00\cdots 0,(\pi_k)_{M_k\text{ is useful}}) Π = ( I , r I = 00 ⋯ 0 , ( π k ) M k is useful ) V ∗ ( r I , G , Π ) V^*(r_I,G,\Pi) V ∗ ( r I , G , Π ) :根据 I I I 检查公布的完整 M k M_k M k 是否不是 useful matrix; 是否把 useful matrix 的 M k M_k M k 的 n 6 − n 2 n^6-n^2 n 6 − n 2 个空白单元公布在 I I I 中; 同时, ∀ ( π ( i ) , π ( j ) ) ∉ π ( E ) \forall (\pi(i),\pi(j))\notin \pi(E) ∀ ( π ( i ) , π ( j )) ∈ / π ( E ) ,需要满足 ( π ( i ) , π ( j ) ) ∈ I (\pi(i),\pi(j))\in I ( π ( i ) , π ( j )) ∈ I 且 M C ( π ( i ) , π ( j ) ) = 0 M_C(\pi(i),\pi(j))=0 M C ( π ( i ) , π ( j )) = 0 。 💡
Completeness . 与 modified 版本相同。
Adaptive Soundness . 如果 M k M_k M k 是 useful matrix,那么 adaptive soundness error 为 0(因为是在 modified 版本中证明了是 perfect adaptive soundness)。如果没有任何一个 M k M_k M k 是 useful 的,那么 V ∗ V^* V ∗ 会将不在语言中的 x ∉ L ∗ x\notin L^* x ∈ / L ∗ 误判为 1,这样的概率为:
Pr [ V ( r I , x , π ~ , I ) = 1 ∧ x ∉ L ] = ( 1 − Ω ( n − 2 ) ) n 3 ≤ e − Ω ( n ) = negl ( n ) \text{Pr}[V(r_I,x,\tilde{\pi},I)=1 \wedge x\notin L]=(1-\Omega(n^{-2}))^{n^3}\leq e^{-\Omega(n)}=\text{negl}(n) Pr [ V ( r I , x , π ~ , I ) = 1 ∧ x ∈ / L ] = ( 1 − Ω ( n − 2 ) ) n 3 ≤ e − Ω ( n ) = negl ( n ) Zero Knowledge . 存在一个仿真器 SIM ( 1 κ , G = ( V , E ) ) → ( r I , π , I ) \text{SIM}(1^\kappa,G=(V,E))\rightarrow(r_I,\pi,I) SIM ( 1 κ , G = ( V , E )) → ( r I , π , I ) ,仿照 modified 版本与 P ∗ P^* P ∗ 的构造类似构造即可。
Adaptive Zero Knowledge for L ∗ L^* L ∗ . 下面我们想说明,使用上述方法构建的 NIZK (in CRS Model) 自然地具有 Adaptive ZK 性质。
对汉密尔顿圈,Modified Hidden-Bits Model NIZK ↔ Hidden-Bits Model NIZK ↔ (a)NIZK . 因此我们现在将要写出完整的 aNIZK 表达形式(将每步规约应用上)。 P ∗ ( r , G = ( V , E ) , W = C k ) of NIZK ( P ∗ , V ∗ ) r = ( r 1 , r 2 , ⋯ , r n 3 ⋅ ( n 3 ⋅ n 3 ) ⋅ 5 log 2 n ) ← { 0 , 1 } n 3 ⋅ ( n 3 ⋅ n 3 ) ⋅ 5 log 2 n ⋅ κ ( f , f − 1 ) ← GenF ( 1 κ ) ; z i = f − 1 ( r i ) ; r i ′ = h ( z i ) r ′ = ( r 1 ′ , r 2 ′ , ⋯ , r n 3 ⋅ ( n 3 ⋅ n 3 ) ⋅ 5 log 2 n ′ ) ∈ { 0 , 1 } n 3 ⋅ ( n 3 ⋅ n 3 ) ⋅ 5 log 2 n ( M 1 , M 2 , ⋯ , M n 3 ) ← SamMatrix ( r ′ ) For k = 1 to n 3 If M k is not useful, then I ← I ∪ Index ( M k ) else I ← I ∪ Index ( M k \ C k ) Choose random permutation π k s.t. the cycle W covers C k For each ( i , j ) ∈ E such E ( i , j ) = 0 and M C k ( π k ( i ) , π k ( j ) ) = 0 I ← I ∪ { Index ( M k ( π k ( i ) , π k ( j ) ) ) } Π = ( f , ( π k ) useful M k , I , ( z i ) i ∈ I ) Return Π \begin{aligned}& \color{red} P^*(r,G=(V,E),W=C_k) \text{ of NIZK } (P^*,V^*) \\ &r=(r_1,r_2,\cdots,r_{n^3\cdot(n^3\cdot n^3)\cdot 5\log_2n})\leftarrow\{0,1\}^{n^3\cdot(n^3\cdot n^3)\cdot 5\log_2n \cdot \kappa}\\ &(f,f^{-1})\leftarrow\text{GenF}(1^\kappa);\\ &z_i=f^{-1}(r_i);r_i'=h(z_i) \\ & r'=(r_1',r_2',\cdots,r_{n^3\cdot(n^3\cdot n^3)\cdot 5\log_2n}')\in\{0,1\}^{n^3\cdot(n^3\cdot n^3)\cdot 5\log_2n}\\ &(M_1,M_2,\cdots,M_{n^3})\leftarrow\text{SamMatrix}(r')\\&\text{For }k=1\text{ to }n^3 \\ &\quad \text{If }M_k \text{ is not useful, then} \\ &\quad \quad I \leftarrow I \cup \text{Index}(M_k) \\ &\quad \text{else } \\ &\quad \quad I \leftarrow I \cup \text{Index}(M_k\backslash C_k) \\ & \quad \quad \text{Choose random permutation }\pi_k \text{ s.t. the cycle }W\text{ covers }C_k \\&\quad \quad \text{For each }(i,j)\in E \text{ such } E(i,j)=0 \text{ and }M_{C_k}(\pi_k(i),\pi_k(j))=0 \\ &\quad\quad\quad I\leftarrow I\cup\{\text{Index}(M_k(\pi_k(i),\pi_k(j)))\} \\ &\Pi=(f,(\pi_k)_{\text{useful } M_k},I,(z_i)_{i\in I}) \\&\text{Return }\Pi\end{aligned} P ∗ ( r , G = ( V , E ) , W = C k ) of NIZK ( P ∗ , V ∗ ) r = ( r 1 , r 2 , ⋯ , r n 3 ⋅ ( n 3 ⋅ n 3 ) ⋅ 5 l o g 2 n ) ← { 0 , 1 } n 3 ⋅ ( n 3 ⋅ n 3 ) ⋅ 5 l o g 2 n ⋅ κ ( f , f − 1 ) ← GenF ( 1 κ ) ; z i = f − 1 ( r i ) ; r i ′ = h ( z i ) r ′ = ( r 1 ′ , r 2 ′ , ⋯ , r n 3 ⋅ ( n 3 ⋅ n 3 ) ⋅ 5 l o g 2 n ′ ) ∈ { 0 , 1 } n 3 ⋅ ( n 3 ⋅ n 3 ) ⋅ 5 l o g 2 n ( M 1 , M 2 , ⋯ , M n 3 ) ← SamMatrix ( r ′ ) For k = 1 to n 3 If M k is not useful, then I ← I ∪ Index ( M k ) else I ← I ∪ Index ( M k \ C k ) Choose random permutation π k s.t. the cycle W covers C k For each ( i , j ) ∈ E such E ( i , j ) = 0 and M C k ( π k ( i ) , π k ( j )) = 0 I ← I ∪ { Index ( M k ( π k ( i ) , π k ( j )))} Π = ( f , ( π k ) useful M k , I , ( z i ) i ∈ I ) Return Π 接下来我们构造 aNIZK 需要的 Sim ∗ = ( Sim 1 ∗ , Sim 2 ∗ ) \text{Sim}^*=(\text{Sim}_1^*,\text{Sim}_2^*) Sim ∗ = ( Sim 1 ∗ , Sim 2 ∗ ) 。
r ← Sim 1 ∗ ( 1 κ ) [ Allow Information Storation, e.g., useful info ] r ′ ← { 0 , 1 } n 3 ⋅ ( n 3 ⋅ n 3 ) ⋅ 5 log 2 n ( M 1 , M 2 , ⋯ , M n 3 ) ← SamMatrix ( r ′ ) For k = 1 to n 3 If M k is not useful, then I ← I ∪ Index ( M k ) else I ← I ∪ Index ( M k \ C k ) set M k to ( 0 ) and modify the corresponding bits in r ′ ( f , f − 1 ) ∈ GenF ( 1 κ ) For r i ′ ∈ r ′ z i ← { 0 , 1 } κ s.t. h ( z i ) = r i ′ r i = f ( z i ) r = ( r 1 ∣ r 2 ∣ ⋯ ∣ r n ) Return r \begin{aligned}&\color{red}r\leftarrow\text{Sim}_1^*(1^\kappa) \quad [\textit{Allow Information Storation, e.g., useful info}]\\& r'\leftarrow\{0,1\}^{n^3\cdot(n^3\cdot n^3)\cdot 5\log_2n} \\& (M_1,M_2,\cdots,M_{n^3})\leftarrow\text{SamMatrix}(r')\\&\text{For }k=1\text{ to }n^3 \\ &\quad\text {If }M_k \text{ is not useful, then }\\ &\quad \quad I\leftarrow I\cup\text{Index}(M_k) \\ &\quad \text{else} \\ &\quad\quad I\leftarrow I\cup\text{Index}(M_k\backslash C_k) \\ & \quad \quad \color{blue} \text{set } M_k \text{ to }(0)\text{ and modify the corresponding bits in }r'\\ &(f,f^{-1})\in\text{GenF}(1^\kappa) \\ &\text{For }r_i' \in r' \\ &\quad z_i\leftarrow\{0,1\}^\kappa \text{ s.t. } h(z_i)=r_i'\\ &\quad r_i=f(z_i)\\ & r=(r_1|r_2|\cdots|r_n) \\&\text{Return }r\end{aligned} r ← Sim 1 ∗ ( 1 κ ) [ Allow Information Storation, e.g., useful info ] r ′ ← { 0 , 1 } n 3 ⋅ ( n 3 ⋅ n 3 ) ⋅ 5 l o g 2 n ( M 1 , M 2 , ⋯ , M n 3 ) ← SamMatrix ( r ′ ) For k = 1 to n 3 If M k is not useful, then I ← I ∪ Index ( M k ) else I ← I ∪ Index ( M k \ C k ) set M k to ( 0 ) and modify the corresponding bits in r ′ ( f , f − 1 ) ∈ GenF ( 1 κ ) For r i ′ ∈ r ′ z i ← { 0 , 1 } κ s.t. h ( z i ) = r i ′ r i = f ( z i ) r = ( r 1 ∣ r 2 ∣ ⋯ ∣ r n ) Return r Π ← Sim 2 ∗ ( G ) [ Allow Information Storation, e.g., useful info ] For k = 1 to n 3 If M k is useful, then I ← I ∪ Index ( M k ) Pick a random permutation π k For each ( i , j ) s.t. E ( i , j ) = 0 For each ( i , j ) ∈ E such E ( i , j ) = 0 and M C k ( π k ( i ) , π k ( j ) ) = 0 I ← I ∪ { Index ( M k ( π k ( i ) , π k ( j ) ) ) } Π = ( f , ( π k ) useful M k , I , ( z i ) i ∈ I ) \begin{aligned}&\color{red}\Pi\leftarrow\text{Sim}_2^*(G) \quad [\textit{Allow Information Storation, e.g., useful info}]\\&\text{For }k=1\text{ to }n^3 \\ &\quad\text {If }M_k \text{ is useful, then }\\ &\quad \quad I\leftarrow I\cup\text{Index}(M_k) \\ &\quad\quad \color{blue}\text{Pick a random permutation }\pi_k \\ &\quad \quad \text{For each }(i,j)\text{ s.t. } E(i,j)=0 \\ &\quad \quad \text{For each }(i,j)\in E \text{ such } E(i,j)=0 \text{ and }M_{C_k}(\pi_k(i),\pi_k(j))=0 \\ &\quad\quad\quad I\leftarrow I\cup\{\text{Index}(M_k(\pi_k(i),\pi_k(j)))\} \\ &\Pi=(f,(\pi_k)_{\text{useful }M_k},I,(z_i)_{i\in I})\end{aligned} Π ← Sim 2 ∗ ( G ) [ Allow Information Storation, e.g., useful info ] For k = 1 to n 3 If M k is useful, then I ← I ∪ Index ( M k ) Pick a random permutation π k For each ( i , j ) s.t. E ( i , j ) = 0 For each ( i , j ) ∈ E such E ( i , j ) = 0 and M C k ( π k ( i ) , π k ( j )) = 0 I ← I ∪ { Index ( M k ( π k ( i ) , π k ( j )))} Π = ( f , ( π k ) useful M k , I , ( z i ) i ∈ I ) 规约省略。