FFXIVLauncher-Netmaui
54 строки · 2.2 Кб
1// NOTE: This file is copy-pasted almost *as-is* from the previous work `Aither.Crypto`
2// hence currently it does not follow XL's naming convetions.
3//
4// It's totally okay to change this. But for now, this is what it is atm.
5// ReSharper disable InconsistentNaming
6
7namespace XIVLauncher.Common.Encryption.BlockCipher
8{
9public interface IBlockCipher
10{
11/// <summary>
12/// A number of bytes that can be processed in a single operation.
13/// </summary>
14/// <remarks>
15/// This property is assumed to be immutable once the block cipher object is created.
16/// Breaking this assumption may cause an undefined behavior.
17/// </remarks>
18int BlockSize { get; }
19
20/// <summary>
21/// Encrypts a single block.
22/// </summary>
23/// <param name="input">
24/// A pointer to the data needs to be encrypted.
25/// It must be valid to read bytes from the pointer where size is indicated by BlockSize property.
26/// </param>
27/// <param name="output">
28/// A pointer to the buffer to store the result of the operation.
29/// It must be valid to write bytes to the pointer where size is indicated by BlockSize property.
30/// </param>
31/// <remarks>
32/// A pointer to input and output **can** overlap to perform in-place operation.
33/// </remarks>
34unsafe void EncryptBlockUnsafe(byte* input, byte* output);
35
36/// <summary>
37/// Decrypts a single block.
38/// </summary>
39/// <param name="input">
40/// A pointer to the data needs to be decrypted.
41/// It must be valid to read bytes from the pointer where size is indicated by BlockSize property.
42/// </param>
43/// <param name="output">
44/// A pointer to the buffer to store the result of the operation.
45/// It must be valid to write bytes to the pointer where size is indicated by BlockSize property.
46/// </param>
47/// <remarks>
48/// A pointer to input and output **can** overlap to perform in-place operation.
49/// </remarks>
50unsafe void DecryptBlockUnsafe(byte* input, byte* output);
51}
52}
53
54// ReSharper restore InconsistentNaming
55