1. 引言

前序博客有:

  • STARK入门知识

Rescue-Prime STARK 针对的场景为:

  • public info:h,Hh,Hh,H
  • private info:xxx
  • 待证明relation:h=H(x)h=H(x)h=H(x)

其中H(∗)H(*)H(∗) 为Rescue-Prime hash函数。

Rescue-Prime hash运算中涉及:

  • trace:witness信息,Rescue-Prime hash算法中每一轮的输入输出;
  • boundary constraints:公开信息,Rescue-Prime hash函数算法中第一轮的补0,以及最后的hash结果;
  • transition constraints(又称为AIR constraints):公开信息,Rescue-Prime hash算法中每一轮的函数运算。

直观版的Rescue-Prime hash运算中trace、boundary constraints、transition constraints 之间的关系可参看:

  • https://github.com/aszepieniec/stark-anatomy/blob/master/code/test_rescue_prime.py#L20

详细的Zero-Knowledge Rescue-Prime STARK证明测试用例可参看:【其中trace为private info,boundary constraints和transition constraints为public info。】

  • https://github.com/aszepieniec/stark-anatomy/blob/master/code/test_stark.py

基于该Rescue-Prime STARK生成的non-interactive proof可用于构建post-quantum signature scheme。

2. Rescue-Prime

Rescue-Prime: a Standard Specification (SoK) 为面向arithmetization的hash函数,其具有a compact description in terms of AIR。
Rescue-Prime的sponge函数构建自Rescue-XLIX permutation fRXLIX:Fm→Fmf_{\mathrm{R}^{\mathrm{XLIX}}} : \mathbb{F}^m \rightarrow \mathbb{F}^mfRXLIX​:Fm→Fm,具有多个几乎完全相同的rounds。每个round包含了6个步骤:

  • 1)Forward S-box:该state中的每个元素都会进行α\alphaα幂运算,其中α\alphaα为最小的invertible power。
  • 2)MDS:state elements向量 会与 具有特殊属性的矩阵 进行相乘运算。
  • 3)Round constants:会对该state中的每个元素 加上 预设的常量。
  • 4)Backward S-box:该state中的每个元素都会进行α−1\alpha^{-1}α−1幂运算,为x→xαx\rightarrow x^{\alpha}x→xα的逆运算。
  • 5)MDS:state elements向量 会与 具有特殊属性的矩阵 进行相乘运算。【与步骤2)中所用的MDS矩阵一样。】
  • 6)Round constants:会对该state中的每个元素 加上 预设的常量。【不同于第3)步中的constant。每一round中,3)和6)中均会采用不同于上一轮的constant值。即round constants的取值与所在round相关。】

所有round几乎完全相同,不同至此在于每个round中的常量值是不同的。Backward S-box步骤看起来是high degree operation。
以上Rescue-XLIX round function中的6个步骤,可看成是non-deterministic transition constraints of degree α\alphaα。

一旦定义了Rescue-XLIX permutation,可使用a sponge function对其实例化来获得Rescue-Prime。
构建过程中,input field elements are absorbed into the top rrr elements of the state in between permutations. After one final permutation, the top rrr elements are read out. The Rescue-Prime hash digest consists of these rrr elements.

常用的STARK proof参数有:

  • prime field of p=407⋅2119+1p = 407 \cdot 2^{119} + 1p=407⋅2119+1 elements
  • α=3\alpha = 3α=3 and α−1=180331931428153586757283157844700080811\alpha^{-1} = 180331931428153586757283157844700080811α−1=180331931428153586757283157844700080811
  • m=2m = 2m=2
  • r=1r = 1r=1.

此外,the input to the hash computation will be a single field element. So in particular, there will be only one round of absorbing and one application of the permutation。

3. Rescue-Prime AIR

The transition constraints for a single round of the Rescue-XLIX permutation are obtained expressing the state values in the middle of the round in terms of the state values at the beginning, and again in terms of the state values at the end, and then equating both expressions.

令 si\boldsymbol{s}_ {i}si​ 为round iii的初始state values,c2i\boldsymbol{c}_ {2i}c2i​ 和 c2i+1\boldsymbol{c}_{2i+1}c2i+1​ 分别为该round步骤3)和步骤6)中所用的round constants,MMM为MDS矩阵,令下图的superscript表示的是element-wise powering。则有:
si+1=M((M(siα)+c2i)1α)+c2i+1\boldsymbol{s}_{i+1} =M(( M (\boldsymbol{s}_i^\alpha) + \boldsymbol{c}_{2i})^{\frac{1}{\alpha}} )+ \boldsymbol{c}_{2i+1}si+1​=M((M(siα​)+c2i​)α1​)+c2i+1​
从而可将single round的transition以如下等式表示:
M(siα)+c2i=(M−1(si+1−c2i+1))α.M (\boldsymbol{s}_i^\alpha) + \boldsymbol{c}_{2i} = \left(M^{-1} (\boldsymbol{s}_{i+1} - \boldsymbol{c}_{2i+1})\right)^\alpha \enspace .M(siα​)+c2i​=(M−1(si+1​−c2i+1​))α.

为了将其用于STARK,transition constraints 应与round无关,换句话说,即需要用一个单独的等式来描述所有round,而不是值针对某round iii。
令 X\boldsymbol{X}X为表示current state(beginning of the round)的变量向量,Y\boldsymbol{Y}Y 为表示 next state (at the end of the round)的变量向量。
令 fc2i(W)\mathbf{f}_ {\boldsymbol{c}_ {2i}}(W)fc2i​​(W) 表示 the vector of mmm polynomials that take the value c2i\boldsymbol{c}_ {2i}c2i​ on οi\omicron^iοi,fc2i+1(W)\mathbf{f}_ {\boldsymbol{c}_{2i+1}}(W)fc2i+1​​(W) 表示the vector of mmm polynomials that take the value c2i+1\boldsymbol{c}_ {2i+1}c2i+1​ on οi\omicron^iοi。
execution trace 的插值domain为 {οi∣0≤i≤T}\lbrace \omicron^i \vert 0 \leq i \leq T\rbrace{οi∣0≤i≤T} for some TTT。

以上 arithmetic transition constraints 等价为:【一共有2m+12m+12m+1个变量,m=wm= \mathsf{w}m=w 个 registers。】
M(Xα)+fc2i(W)=(M−1(Y−fc2i+1(W)))αM(\boldsymbol{X}^\alpha) + \mathbf{f}_ {\boldsymbol{c}_ {2i}}(W) = \left(M^{-1}(\boldsymbol{Y} - \mathbf{f}_ {\boldsymbol{c}_{2i+1}}(W))\right)^\alpha M(Xα)+fc2i​​(W)=(M−1(Y−fc2i+1​​(W)))α

这样,boundary constraints就要简单很多了。

         # absorb。最开始state = [input_element] + [self.field.zero()] * (self.m - 1)# permutation。N round处理。for r in range(self.N):.........# squeeze。最后return state[0]

初始,根据sponge construction的定义,第一个state element是unknown secret,第二个state element为0。
最后(after all NNN rounds或TTT cycles),第一个state element即为已知的hash digest [h][h][h] 中的一个元素,第二个state element不做限制。但是,这第二个state element必须keep secret to be secure,否则attacker可invert该permutation。
从而有boundary constraints (c,r,e)∈{0,…,T}×{0,…,w−1}×F(c, r, e) \in \lbrace 0, \ldots, T \rbrace \times \lbrace 0, \ldots, \mathsf{w}-1 \rbrace \times \mathbb{F}(c,r,e)∈{0,…,T}×{0,…,w−1}×F:【其中,ccc为cycle,rrr为第rrr个element(从0开始),eee为value。】

  • (0,1,0)(0, 1, 0)(0,1,0)
  • (T,0,h)(T, 0, h)(T,0,h).

STARKs中的witness为 the execution trace。此处的execution trace为第一轮的state + 每一轮运行后的state。

4. Rescue-Prime STARK-based Signatures

a non-interactive zero-knowledge proof system可转换为a signature scheme。
STARK可用于证明任意复杂的computational statements。
Rescue-Prime可用于生成cryptographically hard problem instances in a STARK-friendly way——with a compact AIR。因此,可将Rescue-Prime STARK转换为a signature scheme。

为了实现non-interactive,需引入Message-Dependent Fiat-Shamir。
相应的Rescue-Prime STARK Signature Scheme(RPSSS)定义为:

# class RPSSS:def keygen( self ):sk = self.field.sample(os.urandom(17)) # 签名私钥pk = self.rp.hash(sk) # 验签公钥return sk, pkdef sign( self, sk, document ): # document为待签名消息,sps = SignatureProofStream(document) # SignatureProofStream实际为SHA256 hash运算。signature = self.stark_prove(sk, sps)return signaturedef verify( self, pk, document, signature ):sps = SignatureProofStream(document)return self.stark_verify(pk, signature, sps)

Rescue-Prime STARK Signature Scheme(RPSSS)具有:

  • provably secure
  • post-quantum
  • 128-bit security level

RPSSS的性能为:

  • secret key size: 16 bytes (yay!)
  • public key size: 16 bytes (yay!)
  • signature size: ~133 kB
  • keygen time: 0.01 seconds (acceptable)
  • signing time: 250 seconds
  • verification time: 444 seconds

可进一步优化减少proof size,如open a batch of Merkle leafs时,合并common paths。
速度方面可采用C/Rust进一步优化。python性能较弱。也可以对key operations使用更快的算法,从而使得整个RPSSS签名验签速度进一步提升。

如借助FFT,可提升多项式相乘、插值、evaluation等运算,将RPSSS的性能提升为:

  • secret key size: 16 bytes (yay!)
  • public key size: 16 bytes (yay!)
  • signature size: ~160 kB
  • keygen time: 0.01 seconds (acceptable)
  • signing time: 72 seconds
  • verification time: 8 seconds

参考资料

[1] Anatomy of a STARK, Part 5: A Rescue-Prime STARK
[2] Anatomy of a STARK, Part 6: Speeding Things Up

Rescue-Prime hash STARK相关推荐

  1. Rescue-Prime hash STARK 代码解析

    1. 引言 前序博客有: STARK入门知识 STARKs and STARK VM: Proofs of Computational Integrity STARK中的FRI代码解析 Rescue- ...

  2. snark/stark-friendly hash函数

    1. 引言 零知识证明中,需要 prove the knowledge of a preimage under a cryptographic hash function,针对的场景为: public ...

  3. 常见的一些 Hash 函数

    Hash的主要原理就是把大范围映射到小范围:所以,你输入的实际值的个数必须和小范围相当或者比它更小.不然冲突就会很多. 不同的应用对Hash函数有着不同的要求:比如,用于加密的Hash函数主要考虑它和 ...

  4. STARK Low Degree Testing——FRI

    1. 引言 前序博客有: ZKP大爆炸 STARKs and STARK VM: Proofs of Computational Integrity STARK入门知识 STARK中的FRI代码解析 ...

  5. rescue-prime:基于Goldilocks域的Rescue-Prime 哈希函数加速

    1. 引言 前序博客: Goldilocks域 所谓计算友好的哈希函数,是指: 基于素数域元素,而不是 通常的如SHA3-256/SHA256/BLAKE3中的raw bits/bytes/N-bit ...

  6. POJ - 2002 Squares 数正方形【二分】【哈希表】

    Squares POJ - 2002 题意 平面上有N个点,任取4个点,求能组成正方形的不同组合方式有多少种:相同的四个点,不同顺序构成的正方形视为同一正方形 分析 做法1 先枚举两个点,通过计算得到 ...

  7. 关于equals和hashcode方法

    首先声明一下,这篇文章仅仅讨论引用类型 所有引用类型都是继承自Object类,Object类有两个重要的方法:equals(),hashCode()经常被使用,虽然表面上你可能看不到你的代码里使用ha ...

  8. POSEIDON: A New Hash Function for Zero-Knowledge Proof Systems 学习笔记

    1. 引言 Grassi等人2019年论文<POSEIDON: A New Hash Function for Zero-Knowledge Proof Systems>. 前序博客有: ...

  9. 数据结构 单词查找 二分法-索引表-Hash表

    问题说明: 从标准输入中读入一个英文单词及查找方式,在一个给定的英文常用单词字典文件dictionary3000.txt中查找该单词,返回查找结果(查找到返回1,否则返回0)和查找过程中单词的比较次数 ...

最新文章

  1. Solaris下ftp配置(初稿-待补充)
  2. 使用dom4j解析XML例子
  3. 数据结构中几种经典排序简介
  4. AllUsers And SiteUsers
  5. 总结Linux-ubuntu基本配置方法(远程连接,数据库,jdk,tomcat......)
  6. html加载完显示图片,js图片未加载完显示loading效果
  7. 小程序基于mpvue开发坑一
  8. Optional.isEmpty()在JDK 11 EA构建中可用
  9. [react] React16新特性有哪些?
  10. 云计算学习(4-3)虚拟化技术-存储虚拟化
  11. Java学习笔记(3)——资源管理
  12. Blender Python UV 学习
  13. 2月第4周全球域名商TOP15:万网、DNSPod上榜
  14. 面试题:老师生日分析过程,能否建模用程序解答?
  15. spring-speed-up.xml
  16. 免费下载《程序员面试宝典》.pdf
  17. QtableView点击滑动设计
  18. Codeforces1436 A. Reorder
  19. blankcount函数python,统计函数第五讲:计数函数COUNT和COUNTBLANK
  20. scl语言用plc脉冲做定时器_请问SCL语言如何调用定时器

热门文章

  1. 测控仪器专业权威期刊
  2. 应用交付工程师应该具备的关键能力(售前篇)
  3. Xmanager7 解决图形显示问题
  4. [zz]QuickTime电影(Movie)
  5. UNETR 医学图像分割架构 2D版 (Tensorflow2 Keras 实现UNETR)
  6. 用php计算自由落体,JavaScript模拟自由落体
  7. java通过POI快速读取excel大量数据的方式
  8. 第一篇 AlexNet——论文翻译
  9. 字节题--雀魂启动!
  10. CentOS 7 系统部署之四:磁盘扩容与调整