Browse Source

Clarify masking of bits in Field::random impls

Co-Authored-By: Daira Hopwood <[email protected]>
master
str4d 5 years ago committed by GitHub
parent
commit
0255dca16e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      ff/ff_derive/src/lib.rs
  2. 2
      sapling-crypto/src/jubjub/fs.rs

2
ff/ff_derive/src/lib.rs

@ -892,7 +892,7 @@ fn prime_field_impl(
#name(#repr(repr))
};
// Mask away the unused bits at the beginning.
// Mask away the unused most-significant bits.
tmp.0.as_mut()[#top_limb_index] &= 0xffffffffffffffff >> REPR_SHAVE_BITS;
if tmp.is_valid() {

2
sapling-crypto/src/jubjub/fs.rs

@ -292,7 +292,7 @@ impl Field for Fs {
Fs(FsRepr(repr))
};
// Mask away the unused bits at the beginning.
// Mask away the unused most-significant bits.
tmp.0.as_mut()[3] &= 0xffffffffffffffff >> REPR_SHAVE_BITS;
if tmp.is_valid() {

Loading…
Cancel
Save