3434//! function, making it possible to combine generated and hand-crafted
3535//! proof statements into the same constraint system.
3636
37+ /// Implements batch verification of batchable proofs.
38+ pub mod batch_verifier;
3739/// Implements proof creation.
3840pub mod prover;
3941/// Implements proof verification of compact and batchable proofs.
4042pub mod verifier;
41- /// Implements batch verification of batchable proofs.
42- pub mod batch_verifier;
4343
4444use curve25519_dalek:: ristretto:: { CompressedRistretto , RistrettoPoint } ;
4545use curve25519_dalek:: scalar:: Scalar ;
4646use curve25519_dalek:: traits:: IsIdentity ;
4747
48- use crate :: { Transcript , ProofError } ;
48+ use crate :: { ProofError , Transcript } ;
4949
5050/// An interface for specifying proof statements, common between
5151/// provers and verifiers.
@@ -164,12 +164,12 @@ pub trait TranscriptProtocol {
164164
165165impl TranscriptProtocol for Transcript {
166166 fn domain_sep ( & mut self , label : & ' static [ u8 ] ) {
167- self . commit_bytes ( b"dom-sep" , b"schnorrzkp/1.0/ristretto255" ) ;
168- self . commit_bytes ( b"dom-sep" , label) ;
167+ self . append_message ( b"dom-sep" , b"schnorrzkp/1.0/ristretto255" ) ;
168+ self . append_message ( b"dom-sep" , label) ;
169169 }
170170
171171 fn append_scalar_var ( & mut self , label : & ' static [ u8 ] ) {
172- self . commit_bytes ( b"scvar" , label) ;
172+ self . append_message ( b"scvar" , label) ;
173173 }
174174
175175 fn append_point_var (
@@ -178,8 +178,8 @@ impl TranscriptProtocol for Transcript {
178178 point : & RistrettoPoint ,
179179 ) -> CompressedRistretto {
180180 let encoding = point. compress ( ) ;
181- self . commit_bytes ( b"ptvar" , label) ;
182- self . commit_bytes ( b"val" , encoding. as_bytes ( ) ) ;
181+ self . append_message ( b"ptvar" , label) ;
182+ self . append_message ( b"val" , encoding. as_bytes ( ) ) ;
183183 encoding
184184 }
185185
@@ -191,8 +191,8 @@ impl TranscriptProtocol for Transcript {
191191 if point. is_identity ( ) {
192192 return Err ( ProofError :: VerificationFailure ) ;
193193 }
194- self . commit_bytes ( b"ptvar" , label) ;
195- self . commit_bytes ( b"val" , point. as_bytes ( ) ) ;
194+ self . append_message ( b"ptvar" , label) ;
195+ self . append_message ( b"val" , point. as_bytes ( ) ) ;
196196 Ok ( ( ) )
197197 }
198198
@@ -202,8 +202,8 @@ impl TranscriptProtocol for Transcript {
202202 point : & RistrettoPoint ,
203203 ) -> CompressedRistretto {
204204 let encoding = point. compress ( ) ;
205- self . commit_bytes ( b"blindcom" , label) ;
206- self . commit_bytes ( b"val" , encoding. as_bytes ( ) ) ;
205+ self . append_message ( b"blindcom" , label) ;
206+ self . append_message ( b"val" , encoding. as_bytes ( ) ) ;
207207 encoding
208208 }
209209
@@ -215,8 +215,8 @@ impl TranscriptProtocol for Transcript {
215215 if point. is_identity ( ) {
216216 return Err ( ProofError :: VerificationFailure ) ;
217217 }
218- self . commit_bytes ( b"blindcom" , label) ;
219- self . commit_bytes ( b"val" , point. as_bytes ( ) ) ;
218+ self . append_message ( b"blindcom" , label) ;
219+ self . append_message ( b"val" , point. as_bytes ( ) ) ;
220220 Ok ( ( ) )
221221 }
222222
0 commit comments