Clear up doc comments on SpendingKey
This commit is contained in:
parent
760edf9271
commit
2a7838d8e5
|
|
@ -26,8 +26,8 @@ use sha2;
|
||||||
pub struct SpendingKey(pub [u8; 32]);
|
pub struct SpendingKey(pub [u8; 32]);
|
||||||
|
|
||||||
impl SpendingKey {
|
impl SpendingKey {
|
||||||
/// Generate a new _SpendingKey_ with the highest 4 bits set to
|
/// Generate a new _SpendingKey_ with the high 4 bits of the first
|
||||||
/// zero (ie, 256 random bits, clamped to 252).
|
/// byte set to zero (ie, 256 random bits, clamped to 252).
|
||||||
pub fn new<T>(csprng: &mut T) -> Self
|
pub fn new<T>(csprng: &mut T) -> Self
|
||||||
where
|
where
|
||||||
T: RngCore + CryptoRng,
|
T: RngCore + CryptoRng,
|
||||||
|
|
@ -40,8 +40,9 @@ impl SpendingKey {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<[u8; 32]> for SpendingKey {
|
impl From<[u8; 32]> for SpendingKey {
|
||||||
/// Generate a _SpendingKey_ from existing bytes, with the highest
|
/// Generate a _SpendingKey_ from existing bytes, with the high 4
|
||||||
/// 4 bits set to zero (ie, 256 bits clamped to 252).
|
/// bits of the first byte set to zero (ie, 256 bits clamped to
|
||||||
|
/// 252).
|
||||||
fn from(mut bytes: [u8; 32]) -> SpendingKey {
|
fn from(mut bytes: [u8; 32]) -> SpendingKey {
|
||||||
bytes[0] &= 0b0000_1111; // Force the 4 high-order bits to zero.
|
bytes[0] &= 0b0000_1111; // Force the 4 high-order bits to zero.
|
||||||
SpendingKey(bytes)
|
SpendingKey(bytes)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue