Skip to content

Commit

Permalink
Add zkCTF wp
Browse files Browse the repository at this point in the history
  • Loading branch information
Xor0v0 authored and Xor0v0 committed Oct 15, 2024
1 parent d6405d9 commit f80c594
Show file tree
Hide file tree
Showing 127 changed files with 40,456 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
site
site
.DS_Store
5 changes: 5 additions & 0 deletions docs/crypto/2+2=5/two_plus_two.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ title: Jolt zkVM - 2+2=5
description: 2024 | MOCA Italian Hacker Camp | Crypto
---

- [1. Background](#1-background)
- [2. Puzzle Description](#2-puzzle-description)
- [3. Alynasis](#3-alynasis)
- [4. EXP](#4-exp)

## 1. Background

[Jolt](https://jolt.a16zcrypto.com/intro.html) 是由 A16Z 的密码学家们提出的一个针对 Risc-V ISA (未来将支持更多ISA)的 zkVM 框架,它底层使用了 sumcheck-based SNARK,这个 SNARK 充分利用多变量多项式及其多项式承诺的优势。Jolt zkVM 据说拥有非常出色的性能表现并且还存在优化空间。
Expand Down
5 changes: 5 additions & 0 deletions docs/crypto/zkCTF/day1/Division Quiz/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/target
Cargo.lock
param
proof
vk
14 changes: 14 additions & 0 deletions docs/crypto/zkCTF/day1/Division Quiz/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[package]
name = "cft"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
backtrace = { version = "0.3", optional = true }
ff = "0.13"
halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", default-features = true }
clap = "3.0"
halo2curves = { version = "0.6.0", default-features = false }
rand = "0.8"
20 changes: 20 additions & 0 deletions docs/crypto/zkCTF/day1/Division Quiz/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# ZK CFT - Halo2 - Int Division

## Overview
1. This is a quiz about Halo2 usage. The standard answer would not be given to participants
2. Instead, a file would be given, with all necessary structs and missing logics. Participants are required to fill in the blanks, compile the program and run tests
3. Multiple test cases would be given, the prover program shall be tested against them

## Problem description
While doing proof we always face some basic arithematics, such as int division. It is a very intuitive operation on normal programming language, but one might find it a bit harder when doing it in crypto world -- for we always use [Finte Field](https://en.wikipedia.org/wiki/Finite_field). For each non-zero element, it has inverse, so that a normal int division is not obeying ordinary division just like Python. For example, in Fp where p = 11, 10 div 3 = 7 mod 11 -- for inverse of 3 is 4, 11 div 3 = 10 times 4 = 7 mod 11. While we expect an 'ordinary' int division: 10 // 3 = 3. Now you are required to simulate an int division in Halo2. We limit the size as U8. So you are actually implementing an U8 division in a finite file Fr, which is the scalar field of ecliptic curve group BN256.

## Comand
cargo run

## Example
Input 10 3 3
Explain: Proof generates and verifier passes it. It is an U8 division

## Solve
Sumbit quiz.rs to solve the puzzle.

1 change: 1 addition & 0 deletions docs/crypto/zkCTF/day1/Division Quiz/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod quiz;
Loading

0 comments on commit f80c594

Please sign in to comment.