Skip to content

Commit

Permalink
Clear up doc comments on SpendingKey
Browse files Browse the repository at this point in the history
  • Loading branch information
dconnolly committed Mar 28, 2020
1 parent 760edf9 commit 2a7838d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions zebra-chain/src/keys/sprout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ use sha2;
pub struct SpendingKey(pub [u8; 32]);

impl SpendingKey {
/// Generate a new _SpendingKey_ with the highest 4 bits set to
/// zero (ie, 256 random bits, clamped to 252).
/// Generate a new _SpendingKey_ with the high 4 bits of the first
/// byte set to zero (ie, 256 random bits, clamped to 252).
pub fn new<T>(csprng: &mut T) -> Self
where
T: RngCore + CryptoRng,
Expand All @@ -40,8 +40,9 @@ impl SpendingKey {
}

impl From<[u8; 32]> for SpendingKey {
/// Generate a _SpendingKey_ from existing bytes, with the highest
/// 4 bits set to zero (ie, 256 bits clamped to 252).
/// Generate a _SpendingKey_ from existing bytes, with the high 4
/// bits of the first byte set to zero (ie, 256 bits clamped to
/// 252).
fn from(mut bytes: [u8; 32]) -> SpendingKey {
bytes[0] &= 0b0000_1111; // Force the 4 high-order bits to zero.
SpendingKey(bytes)
Expand Down

0 comments on commit 2a7838d

Please sign in to comment.