- 
                Notifications
    You must be signed in to change notification settings 
- Fork 305
          key: don't use Hasher to generate fingerprints; just use hashes crate
          #726
        
          New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
85949c7    to
    5e62ce4      
    Compare
  
    | conceptACK. You missed setting the PR title. | 
5e62ce4    to
    0dedcec      
    Compare
  
    Hasher to generate fingerprints; just use hashes crate
      There is no need to hash up the secret for Keypair. It already has a "fingerprint" in the form of its public key. We should just use that.
0dedcec    to
    b8ac971      
    Compare
  
    | CI failure looks like some unrelated  | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK b8ac971
I agree with having Debug tests in cases like this since failing to implement it correctly may lead to key leaks.
| fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { | ||
| f.debug_struct("Keypair") | ||
| .field("pubkey", &self.public_key()) | ||
| .field("secret", &"<hidden>") | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully ran local tests on b8ac971.
…erate fingerprints; just use `hashes` crate b8ac97174541b8341b67f8566d64406154b6c5e4 keypair: use public key for Debug output (Andrew Poelstra) a16e5ecd49a994fd32fe69bcf0666a654ae66581 secret keys: debug output only when `hashes` is enabled (Andrew Poelstra) Pull request description: In addition to changing `SecretKey` and `SharedSecret` to use `hashes`, we also unconditionally use the public half of `KeyPair` as a fingerprint, since that's always available and does not need extra deps. This patches the existing unit tests but doesn't add more. Maybe they should be removed; it's a bit weird to have unit tests for `Debug` output. But in this case we're doing some nontrivial logic and I guess we wanted to double-check that it was taking effect. I'd also like to change the manual tagged-hash implementation to use `bitcoin_hashes` methods but those are under construction rust-bitcoin/rust-bitcoin#3184 and the existing stuff is neither faster nor less code than what's currently done. So we'll live with it. Fixes #725 ACKs for top commit: Kixunil: ACK b8ac97174541b8341b67f8566d64406154b6c5e4 Tree-SHA512: d0a65e0a0069bcbc663c1d3e7f98b75868355c4db48e9a9c905cdcd2af1606ac86090cdf0aae5caa23337c5d565e6420d7c956dd0a65a1877004840075bc08e9
…erate fingerprints; just use `hashes` crate b8ac97174541b8341b67f8566d64406154b6c5e4 keypair: use public key for Debug output (Andrew Poelstra) a16e5ecd49a994fd32fe69bcf0666a654ae66581 secret keys: debug output only when `hashes` is enabled (Andrew Poelstra) Pull request description: In addition to changing `SecretKey` and `SharedSecret` to use `hashes`, we also unconditionally use the public half of `KeyPair` as a fingerprint, since that's always available and does not need extra deps. This patches the existing unit tests but doesn't add more. Maybe they should be removed; it's a bit weird to have unit tests for `Debug` output. But in this case we're doing some nontrivial logic and I guess we wanted to double-check that it was taking effect. I'd also like to change the manual tagged-hash implementation to use `bitcoin_hashes` methods but those are under construction rust-bitcoin/rust-bitcoin#3184 and the existing stuff is neither faster nor less code than what's currently done. So we'll live with it. Fixes #725 ACKs for top commit: Kixunil: ACK b8ac97174541b8341b67f8566d64406154b6c5e4 Tree-SHA512: d0a65e0a0069bcbc663c1d3e7f98b75868355c4db48e9a9c905cdcd2af1606ac86090cdf0aae5caa23337c5d565e6420d7c956dd0a65a1877004840075bc08e9
In addition to changing
SecretKeyandSharedSecretto usehashes, we also unconditionally use the public half ofKeyPairas a fingerprint, since that's always available and does not need extra deps.This patches the existing unit tests but doesn't add more. Maybe they should be removed; it's a bit weird to have unit tests for
Debugoutput. But in this case we're doing some nontrivial logic and I guess we wanted to double-check that it was taking effect.I'd also like to change the manual tagged-hash implementation to use
bitcoin_hashesmethods but those are under construction rust-bitcoin/rust-bitcoin#3184 and the existing stuff is neither faster nor less code than what's currently done. So we'll live with it.Fixes #725