Skip to content

Commit

Permalink
Merge pull request #325 from rubdos/const_fn_for_scalar_from_bits
Browse files Browse the repository at this point in the history
Make Scalar::from_bits a const fn.
  • Loading branch information
hdevalence authored May 29, 2020
2 parents 805cdbf + 3a61a0b commit e342f25
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/scalar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ impl Scalar {
/// This function is intended for applications like X25519 which
/// require specific bit-patterns when performing scalar
/// multiplication.
pub fn from_bits(bytes: [u8; 32]) -> Scalar {
pub const fn from_bits(bytes: [u8; 32]) -> Scalar {
let mut s = Scalar{bytes};
// Ensure that s < 2^255 by masking the high bit
s.bytes[31] &= 0b0111_1111;
Expand Down

0 comments on commit e342f25

Please sign in to comment.