File tree Expand file tree Collapse file tree 5 files changed +11
-12
lines changed Expand file tree Collapse file tree 5 files changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -16,4 +16,5 @@ members = [
1616
1717[patch .crates-io ]
1818digest = { path = " digest" }
19+ ff = { git = " https://github.com/zkcrypto/ff.git" , rev = " 8e139e2fb25ab61a5d362394af0a34b10c03d59b" }
1920signature = { path = " signature" }
Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ impl Field for Scalar {
104104
105105 loop {
106106 rng. try_fill_bytes ( & mut bytes) ?;
107- if let Some ( scalar) = Self :: from_repr ( bytes) . into ( ) {
107+ if let Some ( scalar) = Self :: from_repr ( & bytes) . into ( ) {
108108 return Ok ( scalar) ;
109109 }
110110 }
@@ -149,8 +149,8 @@ impl PrimeField for Scalar {
149149 const ROOT_OF_UNITY_INV : Self = Self :: ZERO ; // BOGUS!
150150 const DELTA : Self = Self :: ZERO ; // BOGUS!
151151
152- fn from_repr ( bytes : FieldBytes ) -> CtOption < Self > {
153- ScalarPrimitive :: from_bytes ( & bytes) . map ( Self )
152+ fn from_repr ( bytes : & FieldBytes ) -> CtOption < Self > {
153+ ScalarPrimitive :: from_bytes ( bytes) . map ( Self )
154154 }
155155
156156 fn to_repr ( & self ) -> FieldBytes {
@@ -898,7 +898,7 @@ mod tests {
898898 #[ test]
899899 fn round_trip ( ) {
900900 let bytes = hex ! ( "c9afa9d845ba75166b5c215767b1d6934e50c3db36e89b127b8a622b120f6721" ) ;
901- let scalar = Scalar :: from_repr ( bytes. into ( ) ) . unwrap ( ) ;
901+ let scalar = Scalar :: from_repr ( & bytes. into ( ) ) . unwrap ( ) ;
902902 assert_eq ! ( & bytes, scalar. to_repr( ) . as_slice( ) ) ;
903903 }
904904}
Original file line number Diff line number Diff line change @@ -293,7 +293,7 @@ mod tests {
293293 #[ test]
294294 fn mul_by_generator ( ) {
295295 let scalar = NonZeroScalar :: from_repr (
296- hex ! ( "c9afa9d845ba75166b5c215767b1d6934e50c3db36e89b127b8a622b120f6721" ) . into ( ) ,
296+ & hex ! ( "c9afa9d845ba75166b5c215767b1d6934e50c3db36e89b127b8a622b120f6721" ) . into ( ) ,
297297 )
298298 . unwrap ( ) ;
299299 let point = NonIdentity :: < ProjectivePoint > :: mul_by_generator ( & scalar) ;
Original file line number Diff line number Diff line change 7777 }
7878
7979 /// Decode a [`NonZeroScalar`] from a big endian-serialized field element.
80- pub fn from_repr ( repr : FieldBytes < C > ) -> CtOption < Self > {
80+ pub fn from_repr ( repr : & FieldBytes < C > ) -> CtOption < Self > {
8181 Scalar :: < C > :: from_repr ( repr) . and_then ( Self :: new)
8282 }
8383
@@ -419,7 +419,7 @@ where
419419 let mut bytes = FieldBytes :: < C > :: default ( ) ;
420420
421421 if base16ct:: mixed:: decode ( hex, & mut bytes) ?. len ( ) == bytes. len ( ) {
422- Self :: from_repr ( bytes) . into_option ( ) . ok_or ( Error )
422+ Self :: from_repr ( & bytes) . into_option ( ) . ok_or ( Error )
423423 } else {
424424 Err ( Error )
425425 }
@@ -465,7 +465,7 @@ mod tests {
465465 #[ test]
466466 fn round_trip ( ) {
467467 let bytes = hex ! ( "c9afa9d845ba75166b5c215767b1d6934e50c3db36e89b127b8a622b120f6721" ) ;
468- let scalar = NonZeroScalar :: from_repr ( bytes. into ( ) ) . unwrap ( ) ;
468+ let scalar = NonZeroScalar :: from_repr ( & bytes. into ( ) ) . unwrap ( ) ;
469469 assert_eq ! ( & bytes, scalar. to_repr( ) . as_slice( ) ) ;
470470 }
471471
You can’t perform that action at this time.
0 commit comments