Mineserver
A rewrite of Minecraft 1.8.9 in C++ !
|
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. | |
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.
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 !
state | The cipher state of the cipher |
key | The key to use with AES |
iv | The IV to use with AES |
crypto::AES128CFB8Cipher::~AES128CFB8Cipher | ( | ) |
Destroy the AES/CFB8 128bit cipher object.
Pretty much explicit. Finally we destroy that longe-named class !
Calculates minimal buffer size for the cipher.
Calculates the minimal buffer size for the cipher, just for the sake of over-optimizing.
len | the length of the input data |
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.
out | the buffer to write into |
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()
data | the data to read then encrypt / decrypt |
len | the length of the data to read |
out | the output buffer |