mirror of
https://github.com/fluencelabs/lazy-snark
synced 2025-06-21 18:51:41 +00:00
wip: add read uncompressed bin
This commit is contained in:
2
test_back_fluence/proof.bin
Normal file
2
test_back_fluence/proof.bin
Normal file
@ -0,0 +1,2 @@
|
||||
<4{ <09><06>
|
||||
"<22><>ҼV".sOU<4F>qw!<21><08>Q<EFBFBD>r]<5D><02><>ۨ{<7B>7<EFBFBD>!.<2E><>ժ;<3B><><EFBFBD>~4Ⱥ<14><>J<EFBFBD>C.
|
2
test_back_fluence/proof2.bin
Normal file
2
test_back_fluence/proof2.bin
Normal file
@ -0,0 +1,2 @@
|
||||
<4{ <09><06>
|
||||
"<22><>ҼV".sOU<4F>qw!<21><08>Q<EFBFBD>r]<10><><EFBFBD>b<EFBFBD>D<EFBFBD>|,<2C>̊<EFBFBD>I0<49>"m<>7<EFBFBD><37>8`<60>B<EFBFBD>w}
|
Binary file not shown.
@ -53,13 +53,22 @@ fn main() {
|
||||
use bellman::groth16::Proof;
|
||||
use bellman::groth16::VerifyingKey;
|
||||
|
||||
use bellman::pairing::{
|
||||
Engine,
|
||||
CurveAffine,
|
||||
EncodedPoint
|
||||
};
|
||||
|
||||
|
||||
use crate::{
|
||||
SynthesisError
|
||||
};
|
||||
|
||||
use std::io::{self, Read};
|
||||
use std::sync::Arc;
|
||||
|
||||
// import verification key
|
||||
|
||||
|
||||
|
||||
self.alpha_g1.into_uncompressed().as_ref();
|
||||
|
||||
//let vk_file = File::open(PathBuf::from("./verification.key")).unwrap();
|
||||
//let vk : VerifyingKey<Bn256> = VerifyingKey::read(vk_file).unwrap();
|
||||
|
||||
@ -69,8 +78,49 @@ fn main() {
|
||||
//let prepared_vk = prepare_verifying_key(&vk);
|
||||
|
||||
// import proof
|
||||
//let proof_file = File::open(PathBuf::from("./proof.key")).unwrap();
|
||||
//let proof : Proof<Bn256> = Proof::read(proof_file).unwrap();
|
||||
let proof_file = File::open(PathBuf::from("./proof.bin")).unwrap();
|
||||
let proof : Proof<Bn256> = Proof::read(proof_file).unwrap();
|
||||
|
||||
// export proof
|
||||
let mut proof_file = File::create(PathBuf::from("./proof2.bin")).unwrap();
|
||||
proof_file.write_all(proof.a.into_uncompressed().as_ref());
|
||||
//proof_file.write_all(proof.b.into_compressed().as_ref());
|
||||
//0x125c6452b97d9b83600e903313aa93284a8b8d8318050ed6af65c10df7ebb5ec
|
||||
//let [u8] =
|
||||
//proof_file.write_all(proof.c.into_compressed().as_ref());
|
||||
|
||||
let mut proof_file = File::open(PathBuf::from("./proof2.bin")).unwrap();
|
||||
//let proof : Proof<Bn256> = Proof::read(proof_file).unwrap();
|
||||
|
||||
|
||||
let mut g1_repr = <bellman::pairing::bn256::G1Affine as CurveAffine>::Uncompressed::empty();
|
||||
//let mut g2_repr = <bellman::pairing::bn256::G2Affine as CurveAffine>::Uncompressed::empty();
|
||||
|
||||
proof_file.read_exact(g1_repr.as_mut());
|
||||
//let a = g1_repr.into_affine();
|
||||
let a = g1_repr
|
||||
.into_affine()
|
||||
.map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))
|
||||
.and_then(|e| if e.is_zero() {
|
||||
Err(io::Error::new(io::ErrorKind::InvalidData, "point at infinity"))
|
||||
} else {
|
||||
Ok(e)
|
||||
}).unwrap();
|
||||
println!("!!! proof a g1: {}", a);
|
||||
|
||||
|
||||
// write proof.a in hex form and binary form
|
||||
let a : G1Affine = proof.a;
|
||||
println!("proof a g1: {}", a);
|
||||
println!("proof a g1 compressed: {:?}", a.into_compressed().as_ref());
|
||||
|
||||
let b : G2Affine = proof.b;
|
||||
println!("proof b g2: {}", b);
|
||||
println!("proof b g2 compressed: {:?}", b.into_compressed().as_ref());
|
||||
|
||||
let c : G1Affine = proof.c;
|
||||
println!("proof c g1: {}", c);
|
||||
println!("proof c g1 uncompressed: {:?}", c.into_compressed().as_ref());
|
||||
|
||||
// import public inputs
|
||||
//let public_inputs = vec![];
|
||||
|
Reference in New Issue
Block a user