StormByte C++ Library: Crypto module 0.0.9999
StormByte-Crypto is a StormByte library module for handling cryptographic operations
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
StormByte::Crypto::Crypter::Symmetric Class Reference

A generic symmetric crypter class. More...

#include <generic.hxx>

Inheritance diagram for StormByte::Crypto::Crypter::Symmetric:
Inheritance graph
[legend]
Collaboration diagram for StormByte::Crypto::Crypter::Symmetric:
Collaboration graph
[legend]

Public Member Functions

 Symmetric (const Symmetric &other)=default
 Copy constructor.
 
 Symmetric (Symmetric &&other) noexcept=default
 Move constructor.
 
virtual ~Symmetric () noexcept=default
 Virtual destructor.
 
Symmetricoperator= (const Symmetric &other)=default
 Copy assignment operator.
 
Symmetricoperator= (Symmetric &&other) noexcept=default
 Move assignment operator.
 
const std::string & Password () const noexcept
 Gets the password used for symmetric encryption.
 
- Public Member Functions inherited from StormByte::Crypto::Crypter::Generic
 Generic (const Generic &other)=default
 Copy constructor.
 
 Generic (Generic &&other) noexcept=default
 Move constructor.
 
virtual ~Generic () noexcept=default
 Virtual destructor.
 
Genericoperator= (const Generic &other)=default
 Copy assignment operator.
 
Genericoperator= (Generic &&other) noexcept=default
 Move assignment operator.
 
bool Encrypt (std::span< const std::byte > input, Buffer::WriteOnly &output) const noexcept
 Encrypt data from input buffer to output buffer.
 
bool Encrypt (const Buffer::ReadOnly &input, Buffer::WriteOnly &output) const noexcept
 Encrypt data from input buffer to output buffer.
 
bool Encrypt (Buffer::ReadOnly &input, Buffer::WriteOnly &output) const noexcept
 Encrypt data from input buffer to output buffer, moving the input data.
 
Buffer::Consumer Encrypt (Buffer::Consumer consumer, ReadMode mode=ReadMode::Move) const noexcept
 Encrypt data from a Consumer buffer.
 
bool Decrypt (std::span< const std::byte > input, Buffer::WriteOnly &output) const noexcept
 Decrypt data from input buffer to output buffer.
 
bool Decrypt (const Buffer::ReadOnly &input, Buffer::WriteOnly &output) const noexcept
 Decrypt data from input buffer to output buffer.
 
bool Decrypt (Buffer::ReadOnly &input, Buffer::WriteOnly &output) const noexcept
 Decrypt data from input buffer to output buffer, moving the input data.
 
Buffer::Consumer Decrypt (Buffer::Consumer consumer, ReadMode mode=ReadMode::Move) const noexcept
 Decrypt data from a Consumer buffer.
 
enum Type Type () const noexcept
 Gets the type of crypter.
 

Static Public Member Functions

static std::string RandomPassword (size_t length=32) noexcept
 Generates a random password for symmetric encryption.
 

Protected Member Functions

 Symmetric (enum Type type, const std::string &password)
 Constructor.
 
- Protected Member Functions inherited from StormByte::Crypto::Crypter::Generic
 Generic (enum Type type)
 Constructor.
 

Protected Attributes

std::string m_password
 The password used for symmetric encryption.
 
- Protected Attributes inherited from StormByte::Crypto::Crypter::Generic
enum Type m_type
 The type of crypter.
 

Detailed Description

A generic symmetric crypter class.

Constructor & Destructor Documentation

◆ Symmetric() [1/3]

StormByte::Crypto::Crypter::Symmetric::Symmetric ( const Symmetric other)
default

Copy constructor.

Parameters
otherThe other Symmetric crypter to copy from.

◆ Symmetric() [2/3]

StormByte::Crypto::Crypter::Symmetric::Symmetric ( Symmetric &&  other)
defaultnoexcept

Move constructor.

Parameters
otherThe other Symmetric crypter to move from.

◆ Symmetric() [3/3]

StormByte::Crypto::Crypter::Symmetric::Symmetric ( enum Type  type,
const std::string &  password 
)
inlineprotected

Constructor.

Parameters
typeThe type of crypter.

Member Function Documentation

◆ operator=() [1/2]

Symmetric & StormByte::Crypto::Crypter::Symmetric::operator= ( const Symmetric other)
default

Copy assignment operator.

Parameters
otherThe other Symmetric crypter to copy from.
Returns
Reference to this Symmetric crypter.

◆ operator=() [2/2]

Symmetric & StormByte::Crypto::Crypter::Symmetric::operator= ( Symmetric &&  other)
defaultnoexcept

Move assignment operator.

Parameters
otherThe other Symmetric crypter to move from.
Returns
Reference to this Symmetric crypter.

◆ Password()

const std::string & StormByte::Crypto::Crypter::Symmetric::Password ( ) const
inlinenoexcept

Gets the password used for symmetric encryption.

Returns
The password.

◆ RandomPassword()

static std::string StormByte::Crypto::Crypter::Symmetric::RandomPassword ( size_t  length = 32)
staticnoexcept

Generates a random password for symmetric encryption.

Parameters
lengthThe length of the password to generate.
Returns
A random password string.

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