You've already forked lidgren-network-gen3
mirror of
https://github.com/lidgren/lidgren-network-gen3.git
synced 2026-05-16 15:16:33 +09:00
Net encryption generalized to support more algorithms
This commit is contained in:
@@ -104,17 +104,9 @@ namespace Lidgren.Network
|
||||
m_isFragment = false;
|
||||
}
|
||||
|
||||
public void Decrypt(NetXtea tea)
|
||||
public bool Decrypt(INetEncryption encryption)
|
||||
{
|
||||
// requires blocks of 8 bytes
|
||||
int blocks = m_bitLength / 64;
|
||||
if (blocks * 64 != m_bitLength)
|
||||
throw new NetException("Wrong message length for XTEA decrypt! Length is " + m_bitLength + " bits");
|
||||
|
||||
byte[] result = new byte[m_data.Length];
|
||||
for (int i = 0; i < blocks; i++)
|
||||
tea.DecryptBlock(m_data, (i * 8), result, (i * 8));
|
||||
m_data = result;
|
||||
return encryption.Decrypt(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user