1
0
mirror of https://github.com/lidgren/lidgren-network-gen3.git synced 2026-05-06 02:11:06 +09:00

XTEA fixed; Message encryption working

This commit is contained in:
lidgren
2010-05-23 10:48:58 +00:00
parent 046ca06ec6
commit e63c52bd7d
7 changed files with 72 additions and 73 deletions

View File

@@ -172,13 +172,13 @@ namespace Lidgren.Network
WritePadBits();
int blocksNeeded = (m_bitLength + 63) / 64;
int missingBits = (blocksNeeded * 64) - m_bitLength;
int missingBytes = missingBits / 8;
int missingBytes = NetUtility.BytesToHoldBits(missingBits);
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);
for(int i=0;i<blocksNeeded;i++)
tea.EncryptBlock(m_data, (i * 8), result, (i * 8));
m_data = result;
}