v0.2.2: updated Lidgren, railgun shells can be bought, autorestart server, netstats, tutorial moloch spawning in a wall fix, misc error checks
This commit is contained in:
@@ -44,7 +44,8 @@ namespace Lidgren.Network
|
||||
/// <summary>
|
||||
/// 16 byte key
|
||||
/// </summary>
|
||||
public NetXtea(byte[] key, int rounds)
|
||||
public NetXtea(NetPeer peer, byte[] key, int rounds)
|
||||
: base(peer)
|
||||
{
|
||||
if (key.Length < c_keySize)
|
||||
throw new NetException("Key too short!");
|
||||
@@ -73,19 +74,26 @@ namespace Lidgren.Network
|
||||
/// <summary>
|
||||
/// 16 byte key
|
||||
/// </summary>
|
||||
public NetXtea(byte[] key)
|
||||
: this(key, 32)
|
||||
public NetXtea(NetPeer peer, byte[] key)
|
||||
: this(peer, key, 32)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// String to hash for key
|
||||
/// </summary>
|
||||
public NetXtea(string key)
|
||||
: this(SHA1.Create().ComputeHash(Encoding.UTF8.GetBytes(key)), 32)
|
||||
public NetXtea(NetPeer peer, string key)
|
||||
: this(peer, NetUtility.ComputeSHAHash(Encoding.UTF8.GetBytes(key)), 32)
|
||||
{
|
||||
}
|
||||
|
||||
public override void SetKey(byte[] data, int offset, int length)
|
||||
{
|
||||
var key = NetUtility.ComputeSHAHash(data, offset, length);
|
||||
NetException.Assert(key.Length >= 16);
|
||||
SetKey(key, 0, 16);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encrypts a block of bytes
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user