Salmon
Loading...
Searching...
No Matches
Mku.Salmon.Encryptor Class Reference

Encrypts byte arrays. More...

Public Member Functions

 Encryptor ()
 Instantiate an encryptor.
 
 Encryptor (int threads)
 Instantiate an encryptor with parallel tasks and buffer size.
 
 Encryptor (int threads, int bufferSize)
 Instantiate an encryptor with parallel tasks and buffer size.
 
byte[] Encrypt (byte[] data, byte[] key, byte[] nonce, EncryptionFormat format, bool integrity=false, byte[] hashKey=null, int chunkSize=0)
 Encrypts a byte array using the provided key and nonce.
 
void Close ()
 Close all associated resources.
 

Detailed Description

Encrypts byte arrays.

Constructor & Destructor Documentation

◆ Encryptor() [1/2]

Mku.Salmon.Encryptor.Encryptor ( int threads)

Instantiate an encryptor with parallel tasks and buffer size.

Parameters
threadsThe number of threads to use.

◆ Encryptor() [2/2]

Mku.Salmon.Encryptor.Encryptor ( int threads,
int bufferSize )

Instantiate an encryptor with parallel tasks and buffer size.

Parameters
threadsThe number of threads to use.
bufferSizeThe buffer size to use. It is recommended for performance to use a multiple of the chunk size if you enabled integrity otherwise a multiple of the AES block size (16 bytes).

Member Function Documentation

◆ Encrypt()

byte[] Mku.Salmon.Encryptor.Encrypt ( byte[] data,
byte[] key,
byte[] nonce,
EncryptionFormat format,
bool integrity = false,
byte[] hashKey = null,
int chunkSize = 0 )

Encrypts a byte array using the provided key and nonce.

Parameters
dataThe byte array to be encrypted.
keyThe AES key to be used.
nonceThe nonce to be used.
formatThe format to use, see EncryptionFormat
integrityTrue if you want to calculate and store hash signatures for each chunkSize.
hashKeyHash key to be used for all chunks.
chunkSizeThe chunk size.
Returns
The byte array with the encrypted data.
Exceptions
SecurityExceptionThrown when error with security
IOExceptionThrown if error during IO
IntegrityExceptionThrown when data are corrupt or tampered with.

The documentation for this class was generated from the following file: