Weird AES question

If I run this code, I’m trying to encrypt “0123456789012345” using key “aaaaaaaaaaaaaaaa”

#include "DigiKeyboard.h"
#include <AESLib.h>
#include "base64.hpp"

void setup() {

void loop() {
  uint8_t key[] = {97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97};
  unsigned char data[] = "0123456789012345"; 
  unsigned char base64[100];

  aes128_enc_single(key, data);
  encode_base64(data, sizeof(data),base64 );


I would get the output of


but If I run the data above with a website like Online Tool for AES Encryption and Decryption

I would get


I’m using these repos for aes and base64

The first 16 bytes appear to be identical. I guess that the website result includes a trailing line feed or something that results in a two-block (32 byte) result rather than the wanted 16 bytes.

Is there a way to make them produce the same result? What kind of padding should I add?

Why do you think that the output from the web site is correct?

Please read up on C-strings ( zero terminated character arrays). The string length, and the result of sizeof() are not the same.

I'm just looking for consistency between the board and something easily accessible

That will be difficult if you don't pay attention to the help you have already received.

The base64 in your code is not created from 16 bytes because "sizeof(data)" is 17 (null terminated string), this is a bug in your code.

As far as I remember AES will always add padding, so if you encrypt one block of 13 bytes, it will be padded to 16 bytes. If you encrypt one block of 16 bytes it will be padded with an entire block. If you (on the website) remove one character of the input text, the output is only half of a 16 byte encrypt. That is just how things work and if you want to reproduce the online result, you will need to add the padding.