Exemple #1
0
        public override void Encode(ByteSpan code)
        {
            code[0] = Depth;
            Fingerprint.AsSpan().CopyTo(code.Slice(1, 4));
            code[5] = (byte)((Child >> 24) & 0xFF);
            code[6] = (byte)((Child >> 16) & 0xFF);
            code[7] = (byte)((Child >> 8) & 0xFF);
            code[8] = (byte)(Child & 0xFF);
            ChainCode.Span.CopyTo(code.Slice(9, 32));
            var key = PublicKey.Data;

            Debug.Assert(key.Length == 33);
            key.CopyTo(code.Slice(41, 33));
        }
Exemple #2
0
        public override void Encode(ByteSpan code)
        {
            code[0] = Depth;
            var s = Fingerprint.AsSpan();

            s.CopyTo(code.Slice(1, 4));
            code[5] = (byte)((Child >> 24) & 0xFF);
            code[6] = (byte)((Child >> 16) & 0xFF);
            code[7] = (byte)((Child >> 8) & 0xFF);
            code[8] = (byte)(Child & 0xFF);
            ChainCode.Span.CopyTo(code.Slice(9, UInt256.Length));
            code[41] = 0;
            var key = PrivateKey.Bytes;

            Debug.Assert(key.Length == UInt256.Length);
            key.CopyTo(code.Slice(42, UInt256.Length));
        }