Salmon
Loading...
Searching...
No Matches
salmon_core.salmon.salmon_encryptor Namespace Reference

Classes

class  SalmonEncryptor
 

Functions

( int, int) encrypt_data (MemoryStream input_stream, int start, int count, bytearray out_data, bytearray key, bytearray nonce, bytearray|None header_data, bool integrity, bytearray|None hash_key, int chunk_size, int buffer_size, str|None shm_cancel_name=None)
 
 encrypt_shm (int index, int part_size, int running_threads, bytearray data, str shm_out_name, int shm_length, str shm_cancel_name, bytearray key, bytearray nonce, bytearray|None header_data, bool integrity, bytearray|None hash_key, int chunk_size, int buffer_size)
 

Detailed Description

MIT License

Copyright (c) 2021 Max Kas

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Function Documentation

◆ encrypt_data()

( int, int) encrypt_data ( MemoryStream input_stream,
int start,
int count,
bytearray out_data,
bytearray key,
bytearray nonce,
bytearray | None header_data,
bool integrity,
bytearray | None hash_key,
int chunk_size,
int buffer_size,
str | None shm_cancel_name = None )
Encrypt the data stream. Do not use directly use encrypt() instead.

:param input_stream: The Stream to be encrypted.
:param start:       The start position of the stream to be encrypted.
:param count:       The number of bytes to be encrypted.
:param out_data:     The buffer with the encrypted data.
:param key:         The AES key to be used.
:param nonce:       The nonce to be used.
:param header_data:  The header data to be used.
:param integrity:   True to apply integrity.
:param hash_key:     The key to be used for integrity application.
:param chunk_size:   The chunk size.
:param buffer_size:   The chunk size.
:param shm_cancel_name: The shared memory cancelation name.
:raises IOError:             Thrown if there is an error with the stream.
:raises SalmonSecurityException: Thrown if there is a security exception with the stream.
:raises IntegrityException: Thrown if integrity cannot be applied.

◆ encrypt_shm()

encrypt_shm ( int index,
int part_size,
int running_threads,
bytearray data,
str shm_out_name,
int shm_length,
str shm_cancel_name,
bytearray key,
bytearray nonce,
bytearray | None header_data,
bool integrity,
bytearray | None hash_key,
int chunk_size,
int buffer_size )
Do not use directly use encrypt() instead.
:param index: The worker index
:param part_size: The part size
:param running_threads: The threads
:param data: The data to encrypt
:param shm_out_name: The shared memory name
:param shm_length: The shared memory length
:param shm_cancel_name: The shared memory for cancelation
:param key: The encryption key
:param nonce: The nonce
:param header_data: The header date
:param integrity: True to apply integrity when encrypting
:param hash_key: The hash key for integrity
:param chunk_size: The chunk size for integrity
:param buffer_size: The buffer size