Skip to content

Commit

Permalink
Old unity support
Browse files Browse the repository at this point in the history
  • Loading branch information
imerr committed Mar 6, 2024
1 parent 9f2fe45 commit aefa839
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static AesGCMEncryptionNative()
public static bool IsSupported => _supported;
public static unsafe ArraySegment<byte> Encrypt(byte[] key, byte[] nonce, ArraySegment<byte> plaintext, ArraySegment<byte> dataOut)
{
plaintext.CopyTo(dataOut);
Array.Copy(plaintext.Array, plaintext.Offset, dataOut.Array, dataOut.Offset ,plaintext.Count);
fixed (byte* keyPtr = key)
{
fixed (byte* noncePtr = nonce)
Expand All @@ -57,9 +57,10 @@ public static unsafe ArraySegment<byte> Encrypt(byte[] key, byte[] nonce, ArrayS
}
}
}

public static unsafe ArraySegment<byte> Decrypt(byte[] key, byte[] nonce, ArraySegment<byte> ciphertext, ArraySegment<byte> dataOut)
{
ciphertext.CopyTo(dataOut);
Array.Copy(ciphertext.Array, ciphertext.Offset, dataOut.Array, dataOut.Offset, ciphertext.Count);
fixed (byte* keyPtr = key)
{
fixed (byte* noncePtr = nonce)
Expand Down

0 comments on commit aefa839

Please sign in to comment.