fix(core): Converts BB packets (#406)

- [X] Organizes and splits up bulletin boards
- [X] Converts packets
This commit is contained in:
Kamron Batman 2021-01-13 22:28:31 -08:00 • committed by GitHub
parent bae568d856
commit c58aad733d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 952 additions and 737 deletions

View file

@ -16,6 +16,7 @@
using System;
using System.Buffers.Binary;
using System.Security.Cryptography;
using Server.Network;
using Server.Text;
namespace Server.Accounting.Security
@ -33,7 +34,7 @@ namespace Server.Accounting.Security
{
Span<byte> output = stackalloc byte[m_OutputSize];
var iterations = Utility.RandomMinMax(m_MinIterations, m_MaxIterations);
BinaryPrimitives.WriteUInt16LittleEndian(output.Slice(0, 2), (ushort)iterations);
BinaryPrimitives.WriteUInt16LittleEndian(output.SliceToLength(2), (ushort)iterations);
var rfc2898 = new Rfc2898DeriveBytes(plainPassword, m_SaltSize, iterations, HashAlgorithmName.SHA256);
rfc2898.Salt.CopyTo(output.Slice(2, m_SaltSize));
@ -47,7 +48,7 @@ namespace Server.Accounting.Security
Span<byte> encryptedBytes = stackalloc byte[m_OutputSize];
HexStringConverter.GetBytes(encryptedPassword, encryptedBytes);
var iterations = BinaryPrimitives.ReadUInt16LittleEndian(encryptedBytes.Slice(0, 2));
var iterations = BinaryPrimitives.ReadUInt16LittleEndian(encryptedBytes.SliceToLength(2));
var salt = encryptedBytes.Slice(2, m_SaltSize);
ReadOnlySpan<byte> hash =