1
0
mirror of https://github.com/lidgren/lidgren-network-gen3.git synced 2026-05-16 15:16:33 +09:00

Missing project added; various code cleanups

This commit is contained in:
lidgren
2010-05-14 17:12:26 +00:00
parent bf208b507a
commit 9577d4b4a6
31 changed files with 381 additions and 139 deletions

View File

@@ -161,6 +161,22 @@ namespace Lidgren.Network
return ptr;
}
public void Encrypt(NetXtea tea)
{
// need blocks of 8 bytes
WritePadBits();
int blocksNeeded = (m_bitLength + 63) / 64;
int missingBits = (blocksNeeded * 64) - m_bitLength;
int missingBytes = missingBits / 8;
for (int i = 0; i < missingBytes; i++)
Write((byte)0);
Console.WriteLine("ENCRYPTING " + NetUtility.ToHexString(m_data));
byte[] result = new byte[m_data.Length];
tea.EncryptBlock(m_data, 0, result, 0);
m_data = result;
}
public override string ToString()
{
StringBuilder bdr = new StringBuilder();