public static KzExtPubKey FromPriv(KzExtPrivKey priv) { var key = new KzExtPubKey { _depth = priv.Depth, _fingerprint = priv.Fingerprint, _child = priv.IndexWithHardened, _chaincode = priv.Chaincode, pubkey = priv.PrivKey.GetPubKey() }; return(key); }
public override KzExtKey DeriveBase(int index, bool hardened) { Trace.Assert(index >= 0); var cek = new KzExtPrivKey { _depth = (byte)(_depth + 1), _child = (uint)index | (hardened ? HardenedBit : 0) }; _privkey.GetPubKey().GetID().Span.Slice(0, 4).CopyTo(cek._fingerprint.AsSpan()); bool ok; (ok, cek._privkey, cek._chaincode) = _privkey.Derive(cek._child, _chaincode); return(ok ? cek : null); }
public bool Equals(KzExtPrivKey o) => (object)o != null && base.Equals(o) && _privkey == o._privkey;
public static KzExtPrivKey GetMasterPrivKey(string seed, string seedExtension = null) => KzExtPrivKey.Master(KzHashes.pbkdf2_hmac_sha512(seed.UTF8ToBytes(), $"electrum{seedExtension}".UTF8ToBytes(), 2048).Span);
public static KzExtPrivKey GetMasterPrivKey(string passphrase, string password = null) => KzExtPrivKey.MasterBip39(passphrase, password, passwordPrefix: "electrum");