You've already forked lidgren-network-gen3
mirror of
https://github.com/lidgren/lidgren-network-gen3.git
synced 2026-05-17 07:36:32 +09:00
Encryption fixed
This commit is contained in:
@@ -7,14 +7,15 @@ namespace Lidgren.Network
|
||||
/// <summary>
|
||||
/// Example class; not very good encryption
|
||||
/// </summary>
|
||||
public class NetXorEncryption : INetEncryption
|
||||
public class NetXorEncryption : NetEncryption
|
||||
{
|
||||
private byte[] m_key;
|
||||
|
||||
/// <summary>
|
||||
/// NetXorEncryption constructor
|
||||
/// </summary>
|
||||
public NetXorEncryption(byte[] key)
|
||||
public NetXorEncryption(NetPeer peer, byte[] key)
|
||||
: base(peer)
|
||||
{
|
||||
m_key = key;
|
||||
}
|
||||
@@ -22,7 +23,8 @@ namespace Lidgren.Network
|
||||
/// <summary>
|
||||
/// NetXorEncryption constructor
|
||||
/// </summary>
|
||||
public NetXorEncryption(string key)
|
||||
public NetXorEncryption(NetPeer peer, string key)
|
||||
: base(peer)
|
||||
{
|
||||
m_key = Encoding.UTF8.GetBytes(key);
|
||||
}
|
||||
@@ -30,7 +32,7 @@ namespace Lidgren.Network
|
||||
/// <summary>
|
||||
/// Encrypt an outgoing message
|
||||
/// </summary>
|
||||
public bool Encrypt(NetOutgoingMessage msg)
|
||||
public override bool Encrypt(NetOutgoingMessage msg)
|
||||
{
|
||||
int numBytes = msg.LengthBytes;
|
||||
for (int i = 0; i < numBytes; i++)
|
||||
@@ -44,7 +46,7 @@ namespace Lidgren.Network
|
||||
/// <summary>
|
||||
/// Decrypt an incoming message
|
||||
/// </summary>
|
||||
public bool Decrypt(NetIncomingMessage msg)
|
||||
public override bool Decrypt(NetIncomingMessage msg)
|
||||
{
|
||||
int numBytes = msg.LengthBytes;
|
||||
for (int i = 0; i < numBytes; i++)
|
||||
|
||||
Reference in New Issue
Block a user