Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
zkevm-circuits
zkevm-circuits
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Package Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

新注册的用户请输入邮箱并保存,随后登录邮箱激活账号。后续可直接使用邮箱登录!

  • zkp
  • zkevm-circuitszkevm-circuits
  • Wiki
    • Zkevm docs
  • 13 keccak

13 keccak · Changes

Page history
keccak authored May 17, 2024 by geruiwang's avatar geruiwang
Hide whitespace changes
Inline Side-by-side
Showing with 32 additions and 28 deletions
+32 -28
  • zkevm-docs/13-keccak.markdown zkevm-docs/13-keccak.markdown +32 -28
  • No files found.
zkevm-docs/13-keccak.markdown
View page @ ae70db57
使用开源的Keccak子电路,链接:https://github.com/privacy-scaling-explorations/zkevm-circuits/blob/b8ae7af639af035a6ad5081716012ee2ea48e7cb/zkevm-circuits/src/keccak_circuit.rs,版本为commit:
```
commit b8ae7af639af035a6ad5081716012ee2ea48e7cb
Author: Eduard S <eduardsanou@posteo.net>
Date: Thu May 4 16:35:02 2023 +0200
Update halo2 dependency to v2023_04_20 (#1374)
```
本文主要介绍开源代码如何使用,如何接入。
## Keccak 电路简介
https://github.com/privacy-scaling-explorations/zkevm-circuits 的 Keccak子电路用于证明一个输入字节串和输入的Keccak哈希的对应关系。在其他电路里,需要使用三个变量 (input_rlc, input_len, output_rlc),进行向Keccak子电路的lookup,来验证这三个变量的对应关系。具体的输入、哈希的计算由Keccak内部实现,本项目不做改动。
RLC即随机线性组合,计算RLC需要使用随机值 Challenge.
## zkevm中的使用
在某电路(例如Core)里,遇到要验证Keccak的时候,首先由此电路负责将输入的RLC、哈希的RLC算好,然后将输入的RLC、哈希的RLC、输入的长度这三个变量(input_rlc, input_len, output_rlc),进行向Keccak子电路的lookup。
计算RLC可由一个RLC子电路实现,可以类似Copy子电路。也可以直接由Copy子电路实现。子电路需要提供Challenge,由更新后的SubCircuit接口的synthesize函数提供。
## 开源代码接入
将 keccak_circuit.rs 和 其子目录接入此项目。将其依赖的其他工具类代码等,也接入进来。然后将KeccakCircuit接入SuperCircuit。
## 好处
(选做)Bytecode子电路的所有列可以不用公开了。只需公开code hash。通过对Witness中的Bytecode计算hash,检查是否与code hash一致,来验证Bytecode正确性。
\ No newline at end of file
使用开源的Keccak子电路,链接:https://github.com/privacy-scaling-explorations/zkevm-circuits/blob/b8ae7af639af035a6ad5081716012ee2ea48e7cb/zkevm-circuits/src/keccak_circuit.rs,版本为commit:
```
commit b8ae7af639af035a6ad5081716012ee2ea48e7cb
Author: Eduard S <eduardsanou@posteo.net>
Date: Thu May 4 16:35:02 2023 +0200
Update halo2 dependency to v2023_04_20 (#1374)
```
本文主要介绍开源代码如何使用,如何接入。
## Keccak 电路简介
https://github.com/privacy-scaling-explorations/zkevm-circuits 的 Keccak子电路用于证明一个输入字节串和输入的Keccak哈希的对应关系。在其他电路里,需要使用三个变量 (input_rlc, input_len, output_rlc),进行向Keccak子电路的lookup,来验证这三个变量的对应关系。具体的输入、哈希的计算由Keccak内部实现,本项目不做改动。
RLC即随机线性组合,计算RLC需要使用随机值 Challenge.
## zkevm中的使用
在某电路(例如Core)里,遇到要验证Keccak的时候,首先由此电路负责将输入的RLC、哈希的RLC算好,然后将输入的RLC、哈希的RLC、输入的长度这三个变量(input_rlc, input_len, output_rlc),进行向Keccak子电路的lookup。
计算RLC可由一个RLC子电路实现,可以类似Copy子电路。也可以直接由Copy子电路实现。子电路需要提供Challenge,由更新后的SubCircuit接口的synthesize函数提供。
## 开源代码接入
将 keccak_circuit.rs 和 其子目录接入此项目。将其依赖的其他工具类代码等,也接入进来。然后将KeccakCircuit接入SuperCircuit。
## 好处
(选做)Bytecode子电路的所有列可以不用公开了。只需公开code hash。通过对Witness中的Bytecode计算hash,检查是否与code hash一致,来验证Bytecode正确性。
## 202405更新
通过对代码的改动,output_rlc变为了output_hi, output_lo。即输出哈希值的高128位、低128位。
\ No newline at end of file
Clone repository
  • basics
    • evm
    • halo2
  • code notes
    • binary_number_with_real_selector
    • how to use macro
    • simple_lt
    • simple_lt_word
  • Home
  • image
  • zkevm docs
    • 1 introduction
    • 10 public
    • 11 fixed
    • 12 exp
    • 13 keccak
    • 14 comparisons
    • 15 differences
View All Pages

Copyright © 2024 ChainWeaver Org. All Rights Reserved. 版权所有。

京ICP备2023035722号-3

京公网安备 11010802044225号