Rewrite crypto to use span

This commit is contained in:
Kurt
2026-01-14 16:42:57 -06:00
parent ac79cb06f9
commit 0ad0ee0697
8 changed files with 122 additions and 188 deletions

View File

@@ -1,20 +1,5 @@
namespace NHSE.Core;
using System;
public readonly ref struct EncryptedSaveFile
{
public readonly byte[] Data;
public readonly byte[] Header;
namespace NHSE.Core;
public EncryptedSaveFile(byte[] data, byte[] header)
{
Data = data;
Header = header;
}
#region Equality Comparison
public override bool Equals(object? obj) => false;
public override int GetHashCode() => Data.GetHashCode();
public static bool operator !=(EncryptedSaveFile left, EncryptedSaveFile right) => !(left == right);
public static bool operator ==(EncryptedSaveFile left, EncryptedSaveFile right) => left.Data == right.Data && left.Header == right.Header;
#endregion
}
public readonly record struct EncryptedSaveFile(ReadOnlyMemory<byte> Data, ReadOnlyMemory<byte> Header);