1818//! )
1919//! ```
2020
21+ use alloc:: vec:: Vec ;
2122use ff:: { Field , PrimeField } ;
2223use group:: prime:: PrimeGroup ;
24+ #[ cfg( feature = "std" ) ]
25+ use rand:: { CryptoRng , Rng } ;
26+ #[ cfg( not( feature = "std" ) ) ]
27+ use rand_core:: { CryptoRng , RngCore as Rng } ;
2328use sha3:: { Digest , Sha3_256 } ;
2429use subtle:: { Choice , ConditionallySelectable , ConstantTimeEq } ;
2530
@@ -162,7 +167,7 @@ impl<G: PrimeGroup + ConstantTimeEq> ComposedRelation<G> {
162167 fn prover_commit_simple (
163168 protocol : & CanonicalLinearRelation < G > ,
164169 witness : & <CanonicalLinearRelation < G > as SigmaProtocol >:: Witness ,
165- rng : & mut ( impl rand :: Rng + rand :: CryptoRng ) ,
170+ rng : & mut ( impl Rng + CryptoRng ) ,
166171 ) -> Result < ( ComposedCommitment < G > , ComposedProverState < G > ) , Error > {
167172 protocol. prover_commit ( witness, rng) . map ( |( c, s) | {
168173 (
@@ -185,7 +190,7 @@ impl<G: PrimeGroup + ConstantTimeEq> ComposedRelation<G> {
185190 fn prover_commit_and (
186191 protocols : & [ ComposedRelation < G > ] ,
187192 witnesses : & [ ComposedWitness < G > ] ,
188- rng : & mut ( impl rand :: Rng + rand :: CryptoRng ) ,
193+ rng : & mut ( impl Rng + CryptoRng ) ,
189194 ) -> Result < ( ComposedCommitment < G > , ComposedProverState < G > ) , Error > {
190195 if protocols. len ( ) != witnesses. len ( ) {
191196 return Err ( Error :: InvalidInstanceWitnessPair ) ;
@@ -227,7 +232,7 @@ impl<G: PrimeGroup + ConstantTimeEq> ComposedRelation<G> {
227232 fn prover_commit_or (
228233 instances : & [ ComposedRelation < G > ] ,
229234 witnesses : & [ ComposedWitness < G > ] ,
230- rng : & mut ( impl rand :: Rng + rand :: CryptoRng ) ,
235+ rng : & mut ( impl Rng + CryptoRng ) ,
231236 ) -> Result < ( ComposedCommitment < G > , ComposedProverState < G > ) , Error > {
232237 if instances. len ( ) != witnesses. len ( ) {
233238 return Err ( Error :: InvalidInstanceWitnessPair ) ;
@@ -360,7 +365,7 @@ impl<G: PrimeGroup + ConstantTimeEq> SigmaProtocol for ComposedRelation<G> {
360365 fn prover_commit (
361366 & self ,
362367 witness : & Self :: Witness ,
363- rng : & mut ( impl rand :: Rng + rand :: CryptoRng ) ,
368+ rng : & mut ( impl Rng + CryptoRng ) ,
364369 ) -> Result < ( Self :: Commitment , Self :: ProverState ) , Error > {
365370 match ( self , witness) {
366371 ( ComposedRelation :: Simple ( p) , ComposedWitness :: Simple ( w) ) => {
@@ -634,7 +639,7 @@ impl<G: PrimeGroup + ConstantTimeEq> SigmaProtocolSimulator for ComposedRelation
634639 }
635640 }
636641
637- fn simulate_response < R : rand :: Rng + rand :: CryptoRng > ( & self , rng : & mut R ) -> Self :: Response {
642+ fn simulate_response < R : Rng + CryptoRng > ( & self , rng : & mut R ) -> Self :: Response {
638643 match self {
639644 ComposedRelation :: Simple ( p) => ComposedResponse :: Simple ( p. simulate_response ( rng) ) ,
640645 ComposedRelation :: And ( ps) => {
@@ -654,7 +659,7 @@ impl<G: PrimeGroup + ConstantTimeEq> SigmaProtocolSimulator for ComposedRelation
654659 }
655660 }
656661
657- fn simulate_transcript < R : rand :: Rng + rand :: CryptoRng > (
662+ fn simulate_transcript < R : Rng + CryptoRng > (
658663 & self ,
659664 rng : & mut R ,
660665 ) -> Result < ( Self :: Commitment , Self :: Challenge , Self :: Response ) , Error > {
0 commit comments