1. 引言

Bowe等人2019年论文《Halo: Recursive Proof Composition without a Trusted Setup》。

该论文中的部分verification operation是由group operation主导的。若使用任意的elliptic curve EEE over base field Fp\mathbb{F}_pFp​,则考虑安全因素,得要求group的prime order q≠pq\neq pq​=p。本文协议需要基于scalar field Fq\mathbb{F}_qFq​来表达arithmetic circuit satisfaction,而模拟Fp\mathbb{F}_pFp​ arithmetic over a distinct field is expensive。
Ben-Sasson等人2014年论文《Scalable Zero Knowledge via cycles of elliptic curves》中指出,通过寻找“2-cycle” Ep,EqE_p,E_qEp​,Eq​ of elliptic curves,来分别构建base fields Fp\mathbb{F}_pFp​和Fq\mathbb{F}_qFq​,其中#Ep=q\#E_p=q#Ep​=q、#Eq=p\#E_q=p#Eq​=p。这样就允许proofs constructed using the group EpE_pEp​ to efficiently reason about proofs constructed over EqE_qEq​,反之亦然,as the group operations needed to verify proofs consist of operations in each proving system’s native field。
与Ben-Sasson中寻找pairing-friendly elliptic curve groups不同,Halo论文中寻找的是普通的(非pairing-friendly的)secure 2-cycle elliptic curves。

参看博客 FFT rust代码实现 中指出,为了能用FFT来做多项式乘法,factor(p-1) = 2^s*t,其中的2^s值代表允许的多项式的最高阶数。generator=primitive_root(p)【generator为(p−1)(p−1)(p−1)-th root of unity,有限域内任意xxx,其x(p−1)=1x^{(p-1)}=1x(p−1)=1恒成立】,2s2^s2s-th root of unity的计算方式为power_mod(generator, t, p)。而Curver25519的scalar field Fr的s值仅为2且generator无返回(无论是基于magma还是sagemath)。所以在需要表示多项式相乘的场景下,其并不适用。

本文需要查找:

  • 具有高sss值的scalar field 曲线(factor(p−1)=21s∗t1,factor(q−1)=22s∗t2factor(p-1)=2^s_1*t_1, factor(q-1)=2^s_2*t_2factor(p−1)=21s​∗t1​,factor(q−1)=22s​∗t2​),以便于可使用radix-2 FFTs来加速多项式乘积运算。
  • 两条曲线应有field elements 的multiplicative order为3,即需满足factor(p−1)=21s∗3∗t1,factor(q−1)=22s∗3∗t2factor(p-1)=2^s_1*3*t_1, factor(q-1)=2^s_2*3*t_2factor(p−1)=21s​∗3∗t1​,factor(q−1)=22s​∗3∗t2​,以便可使用curve endomorphisms来优化circuit。
  • 要求gcd(p−1,5)=gcd(q−1,5)=1gcd(p-1,5)=gcd(q-1,5)=1gcd(p−1,5)=gcd(q−1,5)=1,以便允许实例化the Rescue hash function with α=5\alpha=5α=5。

最终找到的2-cycle 曲线为Tweedledum和Tweedledee:(构建细节参见 https://github.com/daira/tweedle)

sage: p=2^254+4707489545178046908921067385359695873
sage: q=2^254+4707489544292117082687961190295928833
sage: factor(p-1)
2^33 * 3 * 5179 * 216901160674121772178243990852639108850176422522235334586122689
sage: factor(q-1)
2^34 * 3 * 4322432633228119 * 129942003317277863333406104563609448670518081918257
sage: gcd(p-1,5)
1
sage: gcd(q-1,5)
1

Tweedledum和Tweedledee具有126-bit security against Pollard rho attacks,其中已考虑了the additional endomorphisms可能可用于加速Pollard rho和discrete log algorithms的影响。

目前,基于Tweedledum和Tweedledee的加法运算还有缺陷:如无法add two points with the same xxx-coordinate。在实际使用时,要注意做相应的加法判断。根据 ZCash Issue 3924 – Faster variable-base scalar multiplication in zk-SNARK circuits 中讨论指出,实际circuit中的运算以scalar multiplication为主,小心调用加法运算的话,仍可满足要求。基于其它场景使用Tweedledum和Tweedledee的有缺陷加法运算时,需要额外注意。
constant-time formulae for prime-order short Weierstrass curves可参考[34][35]论文进行实现。
recommend that fault attacks on the prover be addressed by validating the proof immediately after creating it。


注意:
https://github.com/zcash/halo2/ 中实现的才是Tweedledum和Tweedledee曲线。
https://github.com/ebfull/halo 中实现的是另外的曲线,具体参见 博客Halo——zcash新的零知识证明机制,无需Trusted Setup 第2.1节的Sage脚本。

2. 基于Endomorphism的优化

Tweedledum和Tweedledee曲线具有endomorphism属性:
ϕ((x,y))=(ζpx,y)\phi((x,y))=(\zeta_p x,y)ϕ((x,y))=(ζp​x,y),其中ϕ(P)=ϕ((x,y))=[ζq]P\phi(P)=\phi((x,y))=[\zeta_q]Pϕ(P)=ϕ((x,y))=[ζq​]P。
具体表示为如下sage脚本中的ZETA_Q*P==E0(ZETA_P*P_X,P_Y)ZETA_P*Q==E1(ZETA_Q*Q_X,Q_Y)

sage: p=2^254+4707489545178046908921067385359695873
sage: q=2^254+4707489544292117082687961190295928833
sage: E0=EllipticCurve(GF(p),[0,0,0,0,5])
sage: E1=EllipticCurve(GF(q),[0,0,0,0,5])
sage: p==E1.cardinality()
True
sage: q==E0.cardinality()
True
sage: P=E0.random_point()
sage: P
(25415224292215053840310240764851735169556717411553406219487045218995850661949 : 4829591991374067821915488208957431679276929647073667653556404306802668725390 : 1)
sage: P_X=P[0]
sage: P_X
25415224292215053840310240764851735169556717411553406219487045218995850661949
sage: P_Y=P[1]
sage: P_Y
4829591991374067821915488208957431679276929647073667653556404306802668725390
sage: ZETA_P=0x1508415ab5e97c949bebc9146ef83d9a7881fb239ba41a268598abb3a410c9c8
sage: ZETA_Q=0x36c66d3a1e049a5887ad8b5ff9731ffe69cf8de720e52ec14394c2bd148fa4fd
sage: ZETA_Q*P==E0(ZETA_P*P_X,P_Y)
True
sage:
sage: Q=E1.random_point()
sage: Q
(5773639204296723226175041348081614707458447404838782763177823928351008544900 : 25210718496048380236355065626215601675438375804308336026355938934156423688663 : 1)
sage: Q_X=Q[0]
sage: Q_Y=Q[1]
sage: Q_X
5773639204296723226175041348081614707458447404838782763177823928351008544900
sage: Q_Y
25210718496048380236355065626215601675438375804308336026355938934156423688663
sage: ZETA_P*Q==E1(ZETA_Q*Q_X,Q_Y)
True
sage:

也就是说,verifier challenge r∈{0,1}λr\in\{0,1\}^{\lambda}r∈{0,1}λ,与直接将rrr解析为a scalar然后perform a scalar multiplication of a Fp\mathbb{F}_pFp​-rational point PPP不同,借助endomorphism特性,借助如下算法来multiply by a scalar that is dependent on rrr:

https://github.com/zcash/halo2/中相应算法代码实现为:【注意r2i,r2i+1∈{0,1}r_{2i},r_{2i+1}\in \{0,1\}r2i​,r2i+1​∈{0,1},所以Si∈{P,−P,ϕ(P),ϕ(−P)}S_i\in\{P,-P,\phi(P),\phi(-P)\}Si​∈{P,−P,ϕ(P),ϕ(−P)},其中ϕ(−P)=[−ζq]P\phi(-P)=[-\zeta_q]Pϕ(−P)=[−ζq​]P】

/// This algorithm applies the mapping of Algorithm 1 from the
/// [Halo](https://eprint.iacr.org/2019/1021) paper.
pub fn get_challenge_scalar<F: Field>(challenge: Challenge) -> F {let mut acc = (F::ZETA + F::one()).double();for i in (0..64).rev() {// 若r_{2i}=0,则 should_negate=true;否则should_negate=false。// 若r_{2i+1}=0,则should_endo=false;否则should_endo=true。let should_negate = ((challenge.0 >> ((i << 1) + 1)) & 1) == 1;let should_endo = ((challenge.0 >> (i << 1)) & 1) == 1;let q = if should_negate { -F::one() } else { F::one() };let q = if should_endo { q * F::ZETA } else { q };acc = acc + q + acc;}acc
}

Halo中的elliptic curve cycle相关推荐

  1. android 公钥pem编码,如何将PEM编码的Elliptic Curve公钥加载到Bouncy Castle中?

    我有一个PEM编码的Elliptic Curve公钥,我正试图加载到Bouncy Castle中,到目前为止我尝试的所有内容都失败了.这是我正在尝试加载的密钥的示例: -----BEGIN PUBLI ...

  2. Elliptic Curve Cryptography (ECC) and Pairings 椭圆曲线密码学与配对

    本文是Dan Boneh 和Victor Shoup所写书籍A Graduate Course in Applied Cryptography的笔记. The group of points of a ...

  3. 椭圆曲线加密(Elliptic Curve Cryptography, ECC)

    近年来,国内外的科研人员面向设备资源受到限制的多种场景提出了很多基于ECC的认证密钥协商协议.虽然各协议应用场景不尽相同,但解决的问题和最终的目标都较为类似,可以归纳为在性能开销尽可能小的前提下,安全 ...

  4. Elliptic Curve Cryptography: a gentle introduction

    转载自:https://www.jianshu.com/p/2e6031ac3d50?from=groupmessage 原文链接:https://andrea.corbellini.name/201 ...

  5. linux安装Openssl步骤详解_问题:OpenSSL: error:100AE081:elliptic curve routines:EC_GROUP_new_by_curve_name:un

    linux上安装Openssl步骤详解 问题: OpenSSL: error:100AE081:elliptic curve routines:EC_GROUP_new_by_curve_name:u ...

  6. 【转】Guide to Elliptic Curve Cryptography(ECC椭圆曲线算法1)

    Guide to Elliptic Curve Cryptography (ECC椭圆曲线算法1) 2017年06月03日 10:14:08 原文 http://andrea.corbellini.n ...

  7. Elliptic curve cryptography

    原文来自wiki 翻译参照Bing在线翻译 - - 部分翻译 Elliptic curve cryptography From Wikipedia, the free encyclopedia Jum ...

  8. Halo中的快速傅里叶(逆)变换算法(I)FFT

    1. FFT背景知识 FFT背景知识可参看博客十分简明易懂的FFT(快速傅里叶变换). 2. Halo中的FFT代码实现 在4核8G ubuntu16.04服务器上运行: cargo test tes ...

  9. Hashing to elliptic curve算法改进

    1. 引言 前序博客有: ECDSA VS Schnorr signature VS BLS signature 第3节"BLS签名" 私钥pkpkpk,对应的公钥为P=pk×GP ...

最新文章

  1. tomcat虚拟路径的几种配置方法
  2. git--命令行放弃修改
  3. 通过a标签在页面上显示视频网站中的视频
  4. oracle awr windows,windows下的oracle 如何生成awr报告
  5. ubuntu卸载vsftpd出错
  6. java多线程 sycophantic_Java多线程volatile和synchronized总结
  7. django国际化与html语言,Django 国际化
  8. set row count
  9. java开发技术有什么意义,零基础学Java开发技术有哪些优势和好处?
  10. 参考文献自动搜集管理完美攻略(图文版): Latex+Lyx+Zotero
  11. [论文阅读] Unifying Global-Local Representations in Salient Object Detection with Transformer
  12. 如何在C预处理器中可靠地检测Mac OS X,iOS,Linux,Windows? [重复]
  13. VS2019、VS2017、VS2013产品密钥
  14. python使用opencv进行身份证信息识别_基于opencv和tesseract实现身份证扫描件的身份证号码提取试验...
  15. 用单片机控制单色显示屏
  16. 挥别2019,喜迎2020
  17. Windows10官网原版系统下载地址汇总
  18. Java 比较图片_Java图片比对
  19. 【求锤得锤的故事】Redis锁从面试连环炮聊到神仙打架
  20. 重新认识差评与客户满意度

热门文章

  1. 国内怎么开通苹果Arcade订阅
  2. Duplicate entry ‘XXX‘ for key ‘XXX.PRIMARY‘解决方案。
  3. Android 图片添加水印
  4. StreamX(1):StreamX概述
  5. js汉字转拼音首字母
  6. 如何把优盘图标换成自己喜欢的图片
  7. OPENCV study
  8. Java百度识别身份证照片、驾驶证识别
  9. unity实现动态广告牌效果
  10. 逻辑学自然科学教育计算机,科学网—【逻辑学知识】自然推理系统 - 黄荣彬的博文...