-
Notifications
You must be signed in to change notification settings - Fork 847
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
Key: add helper method GetSeedBytes #969
base: master
Are you sure you want to change the base?
Conversation
Similar commit as MetacoSA@ce7598f
d6061a5
to
5eb755e
Compare
@@ -407,6 +408,18 @@ public BitcoinSecret GetWif(Network network) | |||
return new BitcoinSecret(this, network); | |||
} | |||
|
|||
public byte[] GetSeedBytes() |
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.
Call it ToBytes
and follow how I implemented it in PubKey
.
Your version is super inefficient.
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.
Ah sure
public byte[] GetSeedBytes() | ||
{ | ||
AssertNotDiposed(); | ||
byte[] bytes = Enumerable.Repeat((byte)0x00, KEY_SIZE).ToArray(); |
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.
new byte[32]
is clearly overrated
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.
oops! didn't realize that the bytes would be overriden later anyway, was just monkey-translating F# code to C# code from somewhere else
@NicolasDorier hey, I just realized that there already is a .ToBytes() method for Key, however:
Let me know what's best please. |
Yes.
Yes it is bad, that said in practice this should hardly matter but I think just using the PubKey approach is also simpler. |
Sorry, if I ask (A or B)? you cannot answer "Yes" unless you're trying to confuse me haha. |
sorry lol, I think we should not add |
878114e
to
24301c6
Compare
My team uses this in more than one place and would be good to have it in NBitcoin out of the box.