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

Bug in reliability fixed

This commit is contained in:
lidgren
2010-05-24 05:25:50 +00:00
parent 7ca55a81e7
commit 2b5967794e
3 changed files with 10 additions and 3 deletions

View File

@@ -43,7 +43,6 @@ namespace Lidgren.Network
throw new NetException("Key too short!"); throw new NetException("Key too short!");
m_numRounds = rounds; m_numRounds = rounds;
m_sum0 = new uint[m_numRounds]; m_sum0 = new uint[m_numRounds];
m_sum1 = new uint[m_numRounds]; m_sum1 = new uint[m_numRounds];
uint[] tmp = new uint[8]; uint[] tmp = new uint[8];
@@ -72,6 +71,14 @@ namespace Lidgren.Network
{ {
} }
/// <summary>
/// String to hash for key
/// </summary>
public NetXtea(string key)
: this(NetSha.Hash(Encoding.ASCII.GetBytes(key)), 32)
{
}
public void EncryptBlock( public void EncryptBlock(
byte[] inBytes, byte[] inBytes,
int inOff, int inOff,

View File

@@ -114,7 +114,7 @@ namespace Lidgren.Network
throw new NetException("Trying to encode NetMessageType " + m_type + " to unconnected endpoint!"); throw new NetException("Trying to encode NetMessageType " + m_type + " to unconnected endpoint!");
ushort seqNr; ushort seqNr;
if (m_type >= NetMessageType.UserReliableUnordered) if (m_type < NetMessageType.UserReliableUnordered)
seqNr = conn.GetSendSequenceNumber(m_type); // "disposable" sequence number seqNr = conn.GetSendSequenceNumber(m_type); // "disposable" sequence number
else else
seqNr = conn.StoreReliableMessage(now, this); seqNr = conn.StoreReliableMessage(now, this);

View File

@@ -13,7 +13,7 @@ namespace UnitTests
// //
// Test XTEA // Test XTEA
// //
NetXtea xtea = new NetXtea(NetSha.Hash(Encoding.ASCII.GetBytes("TopSecret"))); NetXtea xtea = new NetXtea("TopSecret");
byte[] original = new byte[16]; byte[] original = new byte[16];
NetRandom.Instance.NextBytes(original); NetRandom.Instance.NextBytes(original);