mirror of
https://github.com/logos-blockchain/lssa-zkvm-testing.git
synced 2026-01-02 13:23:08 +00:00
wip?
This commit is contained in:
parent
379e098ddb
commit
773610c2f4
@ -1,6 +0,0 @@
|
||||
[workspace]
|
||||
resolver = "2"
|
||||
members = [
|
||||
"guest",
|
||||
"host",
|
||||
]
|
||||
@ -1,3 +1,14 @@
|
||||
[workspace]
|
||||
resolver = "2"
|
||||
members = ["guest", "host"]
|
||||
[package]
|
||||
name = "encryption-demo"
|
||||
version = "0.12.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
risc0-zkvm = "2.2"
|
||||
methods = { path = "methods" }
|
||||
|
||||
[features]
|
||||
cuda = ["risc0-zkvm/cuda"]
|
||||
default = []
|
||||
prove = ["risc0-zkvm/prove"]
|
||||
|
||||
|
||||
@ -1,13 +0,0 @@
|
||||
[package]
|
||||
name = "guest"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
risc0-zkvm = { version = "2.3.1", default-features = false }
|
||||
chacha20 = "0.9"
|
||||
cipher = { version = "0.4", default-features = false }
|
||||
|
||||
[[bin]]
|
||||
name = "guest"
|
||||
path = "src/main.rs"
|
||||
@ -1 +0,0 @@
|
||||
fn main() {}
|
||||
@ -1,15 +0,0 @@
|
||||
[package]
|
||||
name = "host"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
build = "build.rs"
|
||||
|
||||
[dependencies]
|
||||
risc0-zkvm = { version = "2.3.1", features = ["std"] }
|
||||
hex = "0.4"
|
||||
|
||||
[build-dependencies]
|
||||
risc0-build = "2.3.1"
|
||||
|
||||
[package.metadata.risc0]
|
||||
methods = ["/Users/mellaz/Documents/nssa-zkvms/nescience-zkvm-testing/encryption-demo/guest"]
|
||||
@ -1,32 +0,0 @@
|
||||
include!(concat!(env!("OUT_DIR"), "/methods.rs"));
|
||||
|
||||
use risc0_zkvm::{Prover, Receipt};
|
||||
use hex::encode;
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
// Example inputs
|
||||
let key = [0x42u8; 32];
|
||||
let nonce = [0x24u8; 12];
|
||||
let plaintext = b"Hello, RISC Zero ChaCha20 demo!";
|
||||
|
||||
// 1) Create the prover with the embedded guest code
|
||||
let mut prover = Prover::new(&GUEST_ELF, &GUEST_ID)?;
|
||||
|
||||
// 2) Supply inputs
|
||||
prover.add_input_u8_slice(&key);
|
||||
prover.add_input_u8_slice(&nonce);
|
||||
prover.add_input_u8_slice(plaintext);
|
||||
|
||||
// 3) Run, getting a Receipt (proof + journal)
|
||||
let receipt: Receipt = prover.run()?;
|
||||
|
||||
// 4) (Optionally) verify the proof
|
||||
receipt.verify(&GUEST_ID)?;
|
||||
|
||||
// 5) Extract and print the ciphertext
|
||||
let ct: &[u8] = receipt.get_journal_bytes();
|
||||
println!("Ciphertext: {}", encode(ct));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
10
encryption-demo/methods/Cargo.toml
Normal file
10
encryption-demo/methods/Cargo.toml
Normal file
@ -0,0 +1,10 @@
|
||||
[package]
|
||||
name = "methods"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[build-dependencies]
|
||||
risc0-build = { version = "2.2" }
|
||||
|
||||
[package.metadata.risc0]
|
||||
methods = ["guest"]
|
||||
9
encryption-demo/methods/guest/Cargo.toml
Normal file
9
encryption-demo/methods/guest/Cargo.toml
Normal file
@ -0,0 +1,9 @@
|
||||
[package]
|
||||
name = "guest"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
risc0-zkvm = { version = "2.2.0", default-features = false, features = ['std'] }
|
||||
# chacha20 = "0.9"
|
||||
# cipher = { version = "0.4", default-features = false }
|
||||
6
encryption-demo/methods/guest/src/bin/test.rs
Normal file
6
encryption-demo/methods/guest/src/bin/test.rs
Normal file
@ -0,0 +1,6 @@
|
||||
use risc0_zkvm::guest::env;
|
||||
|
||||
fn main() {
|
||||
let a: u128 = env::read();
|
||||
env::commit(&a);
|
||||
}
|
||||
2
encryption-demo/methods/src/lib.rs
Normal file
2
encryption-demo/methods/src/lib.rs
Normal file
@ -0,0 +1,2 @@
|
||||
include!(concat!(env!("OUT_DIR"), "/methods.rs"));
|
||||
|
||||
29
encryption-demo/src/main.rs
Normal file
29
encryption-demo/src/main.rs
Normal file
@ -0,0 +1,29 @@
|
||||
// use risc0_zkvm::{Prover, Receipt};
|
||||
// use hex::encode;
|
||||
|
||||
fn main() {
|
||||
// // Example inputs
|
||||
// let key = [0x42u8; 32];
|
||||
// let nonce = [0x24u8; 12];
|
||||
// let plaintext = b"Hello, RISC Zero ChaCha20 demo!";
|
||||
//
|
||||
// // 1) Create the prover with the embedded guest code
|
||||
// let mut prover = Prover::new(&GUEST_ELF, &GUEST_ID)?;
|
||||
//
|
||||
// // 2) Supply inputs
|
||||
// prover.add_input_u8_slice(&key);
|
||||
// prover.add_input_u8_slice(&nonce);
|
||||
// prover.add_input_u8_slice(plaintext);
|
||||
//
|
||||
// // 3) Run, getting a Receipt (proof + journal)
|
||||
// let receipt: Receipt = prover.run()?;
|
||||
//
|
||||
// // 4) (Optionally) verify the proof
|
||||
// receipt.verify(&GUEST_ID)?;
|
||||
//
|
||||
// // 5) Extract and print the ciphertext
|
||||
// let ct: &[u8] = receipt.get_journal_bytes();
|
||||
// println!("Ciphertext: {}", encode(ct));
|
||||
//
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user