Skip to content

Commit 317dccc

Browse files
committed
Correctness solved. The discrete logarithm test proof in non_interactive_protocol.rs works the same way as the first test proof in sage implementations.
1 parent 0be6685 commit 317dccc

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/toolbox/sigma/schnorr_proof.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,11 @@ where
105105
let end = start + point_size;
106106

107107
let mut buf = vec![0u8; point_size];
108+
buf.copy_from_slice(&data[start..end]);
109+
108110
let mut repr_array = G::Repr::default();
109111
repr_array.as_mut().copy_from_slice(&buf);
110-
buf.copy_from_slice(&data[start..end]);
112+
111113
let elem_ct = G::from_bytes(&repr_array);
112114
if !bool::from(elem_ct.is_some()) {
113115
return None;
@@ -121,9 +123,11 @@ where
121123
let end = start + scalar_size;
122124

123125
let mut buf = vec![0u8; scalar_size];
126+
buf.copy_from_slice(&data[start..end]);
127+
124128
let mut repr_array = <<G as Group>::Scalar as PrimeField>::Repr::default();
125129
repr_array.as_mut().copy_from_slice(&buf);
126-
buf.copy_from_slice(&data[start..end]);
130+
127131
let scalar_ct = G::Scalar::from_repr(repr_array);
128132
if !bool::from(scalar_ct.is_some()) {
129133
return None;

0 commit comments

Comments
 (0)