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

Warnings and minor inconsistencies fixed

This commit is contained in:
lidgren
2014-08-25 07:34:56 +00:00
parent eb9dbdda40
commit f2aa4b4ce2
12 changed files with 115 additions and 105 deletions

View File

@@ -31,6 +31,7 @@ using System.Net.Sockets;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Security.Cryptography;
namespace Lidgren.Network
{
@@ -592,5 +593,23 @@ namespace Lidgren.Network
}
return bdr.ToString();
}
/// <summary>
/// Create a SHA1 digest from a string
/// </summary>
public static byte[] CreateSHA1Hash(string key)
{
using (var sha = SHA1.Create())
return sha.ComputeHash(Encoding.UTF8.GetBytes(key));
}
/// <summary>
/// Create a SHA1 digest from a byte buffer
/// </summary>
public static byte[] CreateSHA1Hash(byte[] data)
{
using (var sha = SHA1.Create())
return sha.ComputeHash(data);
}
}
}