Mineserver
A rewrite of Minecraft 1.8.9 in C++ !
Loading...
Searching...
No Matches
crypto::AES128CFB8Cipher Class Reference

AES/CFB8 128bit cipher class. More...

#include <crypto.h>

Public Member Functions

 AES128CFB8Cipher (CipherState state, const std::byte *key, const std::byte *iv)
 Construct a new AES/CFB8 128bit cipher object.
 
 ~AES128CFB8Cipher ()
 Destroy the AES/CFB8 128bit cipher object.
 
int update (const std::byte *data, size_t len, std::byte *out)
 Updates, encrypting or decrypting depending on the state.
 
int finalize (std::byte *out)
 Finalizes cipher, encrypting / decrypting the rest of the bytes.
 
size_t calculateBufferSize (size_t len)
 Calculates minimal buffer size for the cipher.
 

Detailed Description

AES/CFB8 128bit cipher class.

I know, it is a really long name for a class, but it clearly explains what it does instead of just "cipher". So shut up and accept my beautiful naming talents.

Joking, the name should be changed if someone finds something better. Naming things in programming is too hard.

Constructor & Destructor Documentation

◆ AES128CFB8Cipher()

crypto::AES128CFB8Cipher::AES128CFB8Cipher ( CipherState state,
const std::byte * key,
const std::byte * iv )

Construct a new AES/CFB8 128bit cipher object.

Minecraft doesn't really need both key and iv params, but who knows ! Maybe this very specific piece of code will help someone later on !

Parameters
stateThe cipher state of the cipher
keyThe key to use with AES
ivThe IV to use with AES

◆ ~AES128CFB8Cipher()

crypto::AES128CFB8Cipher::~AES128CFB8Cipher ( )

Destroy the AES/CFB8 128bit cipher object.

Pretty much explicit. Finally we destroy that longe-named class !

Member Function Documentation

◆ calculateBufferSize()

size_t crypto::AES128CFB8Cipher::calculateBufferSize ( size_t len)

Calculates minimal buffer size for the cipher.

Calculates the minimal buffer size for the cipher, just for the sake of over-optimizing.

Parameters
lenthe length of the input data
Returns
size_t the minimal size of the buffer to use

◆ finalize()

int crypto::AES128CFB8Cipher::finalize ( std::byte * out)

Finalizes cipher, encrypting / decrypting the rest of the bytes.

Encrypts or decrypts the remaining bytes in out and returns the written length.

Parameters
outthe buffer to write into
Returns
int the size written

◆ update()

int crypto::AES128CFB8Cipher::update ( const std::byte * data,
size_t len,
std::byte * out )

Updates, encrypting or decrypting depending on the state.

Encrypts or Decrypts the content in data of size len and stores it in out and returns the written size The out buffer should be at least of the length calculated by AES128CFB8Cipher::calculateBufferSize()

Parameters
datathe data to read then encrypt / decrypt
lenthe length of the data to read
outthe output buffer
Returns
int the length of the buffer

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