Merlin——零知识证明(1)理论篇

https://github.com/dalek-cryptography/merlin中的Merlin transcript是基于STROBE(参见博客strobe——面向IoT物联网应用的密码学协议框架)的封装,使用的是keccak-f/1600 128-bit安全级别。

Merlin是基于Fiat-Shamir transform(可参见博客Fiat-Shamir heuristic(含实现)和Random oracle)的实现,通过非交互式的方式实现交互式执行的效果。(直白说就是可将交互式零知识证明转化为非交互式零知识证明。)

1. Merlin VS STROBE

STROBE是一种协议框架,意在构建在线传输协议。而Merlin主要用于零知识证明,仅需要用到STROBE的部分功能。Merlin在实际实现时,可直接调用STROBE库,也可单独实现STROBE中需用到的功能。

Merlin中有两大对象:

2. Merlin transcript operation

Merlin代码库中的Merlin transcript是对STROBE对象的封装,库中使用的是0.3.0版本的strobe-rs库(当前最新版本为0.5.2),实例化为仅支持128-bit安全级别和使用Keccak-f/1600。

app_label:代表特定应用层面的分隔符,为a byte string。Merlin transcripts通常用它来初始化。

构建Merlin transcript的过程为:

  • 1)构建一个STROBE-128对象,该对象具有11-byte label b"Merlin v1.0"
  • 2)将message body消息体通过label b"dom-sep"附加在app_label后面。

Merlin的消息为byte strings,最大可支持4GB(u32::max_value() bytes)。通常不建议使用太长的消息,若消息过长,考虑将其hash化,并将相应的hash值作为消息附加上。
通过STROBE操作,将一条消息message附加在label label上:

AD[label || LE32(message.len())](message);

其中的LE32(x)为4字节的,以little-endian编码的32-bit数字x。采用的是STROBE论文第9页所定义的OP[meta](data)格式。由于Merlin没有传输的概念,其中的metadata采用meta-AD编码。

  • 3)构建完成,返回相应的transcript。

在交互式沟通时,会使用到多个challenges,若要将其转换为非交互式沟通,需要具有能将一序列的challenge bytes依序extract提取出来的能力。
为了将以label标记的一序列challenge bytes提取到buffer dest中,Merlin采用如下的STROBE操作:

dest <- PRF[label || LE32(dest.len())]();

3. Merlin transcript RNG

在Schnorr签名中(可参见博客Schnorr signature (Schnorr 签名)数学原理)nonce为 a bliding factor used for a single sigma-protocoal (a proof of knowledge of the secret key, with the message in the context)。

blinding factor若随机性不好,会从一下多方面毁坏Schnorr签名:

  • guessing the blinding reveals the secret;(见博客Schnorr signature (Schnorr 签名)数学原理第3节内容, k = ( s − r ) / e k=(s-r)/e k=(sr)/e。)
  • using the same blinding for two proofs reveals the secret;(见博客密码学中的sigma-protocol sigma-protocol定义的第2条, w = ( z − z ′ ) ( e − e ′ ) − 1   m o d   q w=(z-z')(e-e')^{-1}\ mod\ q w=(zz)(ee)1 mod q。)
  • leaking a few bits of each blinding factor over many signatures can allow recovery of the secret.

Merlin在证明过程中使用了一个基于STROBE的RNG,目的是防止熵攻击。Merlin的transcript RNG是对一下三种协议的通用概括实现:

Merlin的transcript具有确定性和可生成合成nonce的特性。Merlin提供了一个transcript-based RNG,结合了(2)和(3)的理念,对于Prover,生成随机数的过程为:
*1. creates a secret clone of the public transcript state up to that point, so that the RNG output is bound to the entire public transcript;(Binding the output to the transcript state ensures that two different proof contexts always generate different outputs. This prevents repeating blinding factors between proofs. )
*2. rekeys their clone with their secret witness data, so that the RNG output is bound to their secrets;(Binding the output to the prover’s witness data ensures that the PRF output has at least as much entropy as the witness does. )
*3.rekeys their clone with 32 bytes of entropy from an external RNG, avoiding fully deterministic proofs.(Finally, binding the output to the output of an external RNG provides a backstop and avoids the downsides of fully deterministic generation.)

In Merlin’s setting, the only secrets available to the prover are the witness variables for the proof statement, so in the presence of a weak or failing RNG, the RNG’s entropy is limited to the entropy of the witness variables.

A verifier can also use the transcript RNG to perform randomized verification checks, although defense-in-depth is less essential there. They can skip step 2, and perform only steps 1 and 3.

  • 构建RNG:

通过label标签标记witness secret bytes来更新密钥,Prover执行如下STROBE操作:

KEY[label || LE32(witness.len())](witness);

To finalize the transcript RNG constructor into an RNG, the prover obtains rng, 32 bytes of output from an external rng, then performs

KEY[b"rng"](rng);

Ideally, the transcript, transcript RNG constructor, and transcript RNG should all have different types, so that it is impossible to accidentally rekey the public transcript, or use an RNG before it has been finalized.

参考资料:
[1] 博客strobe——面向IoT物联网应用的密码学协议框架
[2] https://merlin.cool/transcript/ops.html
[3] https://github.com/dalek-cryptography/merlin
[4] 博客Arthur-Merlin protocol交互式知识证明系统

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Merlin GPT是由OpenAI开发的一种自然语言处理(NLP)模型。它是GPT-3的一个变种,旨在生成更加质量高、多样性丰富的文本。 与传统的NLP模型不同,Merlin GPT采用了深度学习技术和大量的训练数据,以便更好地理解和生成人类语言。它使用了相当于1750亿个参数的深度神经网络,这使得它能够处理多种NLP任务,如文本生成、文章摘要、问题回答等。 Merlin GPT的设计目标是提供一种高效且易于使用的工具,以满足用户在自然语言处理方面的需求。它可以根据给定的输入生成连贯流畅、语法正确的文本,使得人机交互更加自然且高效。 在实际应用中,Merlin GPT可以用于各种任务,如机器翻译、文档自动摘要、自动问答、内容生成等。它可以在帮助写作、设计内容、进行创作等方面发挥重要作用。例如,可以利用Merlin GPT生成文章开头、写作建议,或者根据用户输入作出信息提供和解答问题。 尽管Merlin GPT在自然语言处理方面取得了很大的突破,但它仍然存在一些限制。例如,在生成文本时可能会出现语义模糊或错误的情况。此外,Merlin GPT也对敏感信息和不当内容缺乏辨别能力。 总而言之,Merlin GPT是一种先进的自然语言处理模型,具有强大的文本生成能力。它为用户提供了一种便捷且高效的方式来处理各种自然语言处理任务,为人机交互和创作提供了有力的支持。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值