Esempio n. 1
0
        private static void EncryptMessage(ReadOnlySequence <byte> m, INoiseMessageTransformer transport,
                                           ArrayBufferWriter <byte> outputBuffer)
        {
            var l = BitConverter.GetBytes(Convert.ToInt16(m.Length))
                    .Reverse().ToArray(); //from little endian

            transport.WriteMessage(new ReadOnlySequence <byte>(l), outputBuffer);

            transport.WriteMessage(m, outputBuffer);
        }
Esempio n. 2
0
        private static byte[] EncryptMessage(ReadOnlySequence <byte> m, INoiseMessageTransformer transport)
        {
            var outputBuffer = GetArray((int)LightningNetworkConfig.MAX_MESSAGE_LENGTH);

            var l = BitConverter.GetBytes(Convert.ToInt16(m.Length))
                    .Reverse().ToArray(); //from little endian

            transport.WriteMessage(new ReadOnlySequence <byte>(l), outputBuffer);

            transport.WriteMessage(m, outputBuffer);

            return(outputBuffer.WrittenSpan.ToArray());
        }