From 251fba690295d23fd5b14c59e4c03edb263122c0 Mon Sep 17 00:00:00 2001 From: skaunov Date: Mon, 16 Oct 2023 14:39:14 +0300 Subject: [PATCH] I feel better variable naming would look like this. @Divide-By-0 any comments while I didn't start to apply it more widely? --- rust-arkworks/src/lib.rs | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/rust-arkworks/src/lib.rs b/rust-arkworks/src/lib.rs index ec1acc9..500ebe8 100644 --- a/rust-arkworks/src/lib.rs +++ b/rust-arkworks/src/lib.rs @@ -1,7 +1,5 @@ mod error; mod hash_to_curve; -#[cfg(test)] -mod tests; pub mod sig { use crate::error::CryptoError; @@ -50,22 +48,22 @@ pub mod sig { } fn compute_c_v1( - g: &GroupAffine

, + generator: &GroupAffine

, pk: &GroupAffine

, - h: &GroupAffine

, - nul: &GroupAffine

, - g_r: &GroupAffine

, - z: &GroupAffine

, + hash1: &GroupAffine

, + nullifier: &GroupAffine

, + r_point: &GroupAffine

, + hash1_r: &GroupAffine

, ) -> Output { // Compute c = sha512([g, pk, h, nul, g^r, z]) - let g_bytes = affine_to_bytes::

(g); - let pk_bytes = affine_to_bytes::

(pk); - let h_bytes = affine_to_bytes::

(h); - let nul_bytes = affine_to_bytes::

(nul); - let g_r_bytes = affine_to_bytes::

(g_r); - let z_bytes = affine_to_bytes::

(z); - - let c_preimage_vec = [g_bytes, pk_bytes, h_bytes, nul_bytes, g_r_bytes, z_bytes].concat(); + let c_preimage_vec = [ + affine_to_bytes::

(generator), + affine_to_bytes::

(pk), + affine_to_bytes::

(hash1), + affine_to_bytes::

(nullifier), + affine_to_bytes::

(r_point), + affine_to_bytes::

(hash1_r) + ].concat(); Sha256::digest(c_preimage_vec.as_slice()) } @@ -267,3 +265,6 @@ pub mod sig { } } } + +#[cfg(test)] +mod tests; \ No newline at end of file