热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Proof(ofknowledge)ofexponentiation

1.ProofofexponentiationProofofexponentiation是基于adaptiverootassumption(充分必要条件࿰

1. Proof of exponentiation

Proof of exponentiation是基于adaptive root assumption(充分必要条件)的。
在这里插入图片描述
在这里插入图片描述
特别适合当xxx很大时,计算r=xmodl,urr=x\ mod\ l,\ u^rr=x mod l, ur将大量节约verifier直接计算uxu^xux的时间。
在这里插入图片描述

借助Fiat-Shamir heuristic,可将上面的交互式PoE转化为NI-PoE:
在这里插入图片描述
对应在https://github.com/dignifiedquire/rust-accumulators/blob/master/src/proofs.rs中的实现为:

/// NI-PoE Prove
/// Assumes `u^x = w`
/// All operations are `mod n`.
pub fn ni_poe_prove(x: &BigUint, u: &BigUint, w: &BigUint, n: &BigUint) -> ExponentProof {debug_assert!(&u.modpow(x, n) &#61;&#61; w, "invalid input");// l <- H_prime(x, u, w)let mut to_hash &#61; x.to_bytes_be();to_hash.extend(&u.to_bytes_be());to_hash.extend(&w.to_bytes_be());let l &#61; hash_prime::<_, Blake2b>(&to_hash);// q <- floor(x/l)let q &#61; x.div_floor(&l);//Prover sends Q <- u^q ∈ G to the Verifier.u.modpow(&q, n)
}/// NI-PoE Verify
/// Assumes &#96;u^x &#61; w&#96;
/// All operations are &#96;mod n&#96;.
pub fn ni_poe_verify(x: &BigUint,u: &BigUint,w: &BigUint,q: &ExponentProof,n: &BigUint,
) -> bool {// l <- H_prime(x, u, w)let mut to_hash &#61; x.to_bytes_be();to_hash.extend(&u.to_bytes_be());to_hash.extend(&w.to_bytes_be());let l &#61; hash_prime::<_, Blake2b>(&to_hash);// r <- x mod llet r &#61; x.mod_floor(&l);// Q^l u^r &#61;&#61; w&((q.modpow(&l, &n) * &u.modpow(&r, &n)) % n) &#61;&#61; w
}// 基于hash值来获取prime数值。
// When the proofs are made non-interactive, using the
// Fiat-Shamir heuristic the challenge is generated by hashing the previous transcript/// Hash the given numbers to a prime number.
/// Currently uses only 128bits.
pub fn hash_prime, D: Digest>(input: &[u8]) -> BigUint {let mut y &#61; BigUint::from_bytes_be(&D::digest(input)[..16]);while !probably_prime(&y, 20) {y &#61; BigUint::from_bytes_be(&D::digest(&y.to_bytes_be())[..16]);}y
}

2. Proof of knowledge of exponentiation


2.1 有安全攻击隐患的PoKE

在这里插入图片描述
在这里插入图片描述
此时&#xff0c;verifier不需要自己计算余数rrr&#xff0c;改由prover提供。同时注意&#xff0c;此时要求discrete logarithm base ggg必须被包含在CRS中⇒\Rightarrow 存在安全攻击问题&#xff0c;不是secure protocol&#xff1a;
在这里插入图片描述


2.2 基于base ggguuu的两次PoKE

对witness xxx的证明&#xff0c;做了两次PoKE证明&#xff0c;一次是base ggg&#xff0c;一次是base uuu
在这里插入图片描述
以上&#xff0c;proof中包含了两个group元素Q和Q′Q和Q&#39;QQ。如下&#xff0c;通过增加一个challenge α\alphaα&#xff0c;可以将proof中的group元素仍然减为1个QQQ&#xff1a;
在这里插入图片描述
借助Fiat-Shamir heuristic&#xff0c;可将上面的交互式PoKE2转化为NI-PoKE2&#xff1a;
在这里插入图片描述
对应在https://github.com/dignifiedquire/rust-accumulators/blob/master/src/proofs.rs中的实现为&#xff1a;

//proof of knowledge of exponent, i.e. a proof that a computationally bounded prover knows the discrete logarithm between two elements in a group of unknown order. The proof is succinct in that the proof size and verification time is independent of the size of the discrete-log./// NI-PoKE2 Prove
/// assumes &#96;u^x &#61; w&#96;
/// All operations are &#96;mod n&#96;.
pub fn ni_poke2_prove(x: impl Into,u: &BigUint,w: &BigUint,n: &BigUint,
) -> (BigUint, BigUint, BigInt) {let x: BigInt &#61; x.into();debug_assert!(&modpow_uint_int(u, &x, n).unwrap() &#61;&#61; w, "invalid input");// g <- H_G(u, w)let mut to_hash &#61; u.to_bytes_be();to_hash.extend(&w.to_bytes_be());let g &#61; hash_group::<_, Blake2b>(&to_hash, n);// z &#61; g^xlet z &#61; modpow_uint_int(&g, &x, n).expect("invalid state");// l <- H_prime(u, w, z)to_hash.extend(&z.to_bytes_be());let l: BigInt &#61; hash_prime::<_, Blake2b>(&to_hash).into();// alpha &#61; H(u, w, z, l)to_hash.extend(&l.to_bytes_be().1);let alpha &#61; BigUint::from_bytes_be(&Blake2b::digest(&to_hash)[..]);// q <- floor(x/l)// r <- x % llet (q, r) &#61; x.div_rem(&l);// Q <- (ug^alpha)^qlet q_big &#61; modpow_uint_int(&(u * &g.modpow(&alpha, n)), &q, n).expect("invalid state");(z, q_big, r)
}/// NI-PoKE2 Verify
/// assumes &#96;u^x &#61; w&#96;
/// All operations are &#96;mod n&#96;
pub fn ni_poke2_verify(u: &BigUint,w: &BigUint,pi: &(BigUint, BigUint, BigInt),n: &BigUint,
) -> bool {// {z, Q, r} <- pilet (z, q_big, r) &#61; pi;// g <- H_G(u, w)let mut to_hash &#61; u.to_bytes_be();to_hash.extend(&w.to_bytes_be());let g &#61; hash_group::<_, Blake2b>(&to_hash, n);// l <- H_prime(u, w, z)to_hash.extend(&z.to_bytes_be());let l &#61; hash_prime::<_, Blake2b>(&to_hash);// alpha &#61; H(u, w, z, l)to_hash.extend(&l.to_bytes_be());let alpha &#61; BigUint::from_bytes_be(&Blake2b::digest(&to_hash)[..]);// Q^l(ug^alpha)^rlet lhs: BigInt &#61; ((q_big.modpow(&l, n)* modpow_uint_int(&(u * &g.modpow(&alpha, n)), &r, n).expect("invalid state"))% n).into();// wz^alphalet z_alpha &#61; z.modpow(&alpha, n);let rhs: BigInt &#61; ((w * z_alpha) % n).into();lhs &#61;&#61; rhs
}

3. Aggreating Knowledge of Co-prime Roots

在第2节中&#xff0c;已可证明ux&#61;wu^x&#61;wux&#61;w&#xff0c;若有一系列的co-prime roots x1,...,xnx_1,...,x_nx1,...,xn满足wixi&#61;αiw_i^{x_i}&#61;\alpha_iwixi&#61;αigcd(xi,xj)&#61;1∀i,j∈[1,n],i!&#61;jgcd(x_i,x_j)&#61;1\forall i,j\in[1,n],i!&#61;jgcd(xi,xj)&#61;1i,j[1,n],i!&#61;j
在这里插入图片描述
在这里插入图片描述
https://github.com/cambrian/accumulator/中也有相应的代码实现&#xff0c;且实现的性能要优于https://github.com/dignifiedquire/rust-accumulators/
&#96;&#96;

#[allow(non_snake_case)]
#[derive(PartialEq, Eq, Hash, Clone, Debug)]
/// Struct for NI-PoKCR.
pub struct Pokcr {w: G::Elem,
}impl Pokcr {/// Generates an NI-PoKCR proof.pub fn prove(witnesses: &[G::Elem]) -> Self {Self {w: witnesses.iter().fold(G::id(), |a, b| G::op(&a, b)),}}/// Verifies an NI-PoKCR proof.pub fn verify(alphas: &[G::Elem], x: &[Integer], proof: &Self) -> bool {let y &#61; multi_exp::(alphas, x);let lhs &#61; G::exp(&proof.w, &x.iter().product());lhs &#61;&#61; y}
}

参考资料&#xff1a;
[1] 2018年论文《Batching Techniques for Accumulators with Applications to IOPs and Stateless Blockchains》
[2] 博客密码学中的各种假设——DL/SDH…


推荐阅读
  • Explore how Matterverse is redefining the metaverse experience, creating immersive and meaningful virtual environments that foster genuine connections and economic opportunities. ... [详细]
  • 扫描线三巨头 hdu1928hdu 1255  hdu 1542 [POJ 1151]
    学习链接:http:blog.csdn.netlwt36articledetails48908031学习扫描线主要学习的是一种扫描的思想,后期可以求解很 ... [详细]
  • 火星商店问题:线段树分治与持久化Trie树的应用
    本题涉及编号为1至n的火星商店,每个商店有一个永久商品价值v。操作包括每天在指定商店增加一个新商品,以及查询某段时间内某些商店中所有商品(含永久商品)与给定密码值的最大异或结果。通过线段树分治和持久化Trie树来高效解决此问题。 ... [详细]
  • 数据库内核开发入门 | 搭建研发环境的初步指南
    本课程将带你从零开始,逐步掌握数据库内核开发的基础知识和实践技能,重点介绍如何搭建OceanBase的开发环境。 ... [详细]
  • 本文深入探讨了 Java 中的 Serializable 接口,解释了其实现机制、用途及注意事项,帮助开发者更好地理解和使用序列化功能。 ... [详细]
  • 基于KVM的SRIOV直通配置及性能测试
    SRIOV介绍、VF直通配置,以及包转发率性能测试小慢哥的原创文章,欢迎转载目录?1.SRIOV介绍?2.环境说明?3.开启SRIOV?4.生成VF?5.VF ... [详细]
  • 本文介绍如何在现有网络中部署基于Linux系统的透明防火墙(网桥模式),以实现灵活的时间段控制、流量限制等功能。通过详细的步骤和配置说明,确保内部网络的安全性和稳定性。 ... [详细]
  • 本文深入探讨了HTTP请求和响应对象的使用,详细介绍了如何通过响应对象向客户端发送数据、处理中文乱码问题以及常见的HTTP状态码。此外,还涵盖了文件下载、请求重定向、请求转发等高级功能。 ... [详细]
  • PHP 过滤器详解
    本文深入探讨了 PHP 中的过滤器机制,包括常见的 $_SERVER 变量、filter_has_var() 函数、filter_id() 函数、filter_input() 函数及其数组形式、filter_list() 函数以及 filter_var() 和其数组形式。同时,详细介绍了各种过滤器的用途和用法。 ... [详细]
  • 对 manual_async_fn 进行了改进,确保其能够正确处理和捕获输入的生命周期。 ... [详细]
  • QUIC协议:快速UDP互联网连接
    QUIC(Quick UDP Internet Connections)是谷歌开发的一种旨在提高网络性能和安全性的传输层协议。它基于UDP,并结合了TLS级别的安全性,提供了更高效、更可靠的互联网通信方式。 ... [详细]
  • python的交互模式怎么输出名文汉字[python常见问题]
    在命令行模式下敲命令python,就看到类似如下的一堆文本输出,然后就进入到Python交互模式,它的提示符是>>>,此时我们可以使用print() ... [详细]
  • 本文详细介绍了如何在Linux系统上安装和配置Smokeping,以实现对网络链路质量的实时监控。通过详细的步骤和必要的依赖包安装,确保用户能够顺利完成部署并优化其网络性能监控。 ... [详细]
  • 本文介绍了在安装或运行 Python 项目时遇到的 'ModuleNotFoundError: No module named setuptools_rust' 错误,并提供了解决方案。 ... [详细]
  • XNA 3.0 游戏编程:从 XML 文件加载数据
    本文介绍如何在 XNA 3.0 游戏项目中从 XML 文件加载数据。我们将探讨如何将 XML 数据序列化为二进制文件,并通过内容管道加载到游戏中。此外,还会涉及自定义类型读取器和写入器的实现。 ... [详细]
author-avatar
饰间人爱642_370
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有