Skip to content

Latest commit

 

History

History
36 lines (22 loc) · 894 Bytes

README.md

File metadata and controls

36 lines (22 loc) · 894 Bytes

krypto

Cryptography algorithms written in C++20

Current Algorithms

AES

  • Padding: ANSI X9.23, PKCS#7
  • Modes: ECB, CBC

Implementation notes

The input is padded, so no need to give an exact multiple of 16 byte input.

Any sequential container that adhere to the contiguous_iterator concept can be passed as key, plain text and cipher text.

Examples

#include "krypto/aes.h"
...

std::array<unsigned char, 32> key = { 0x00, 0x01, ..., 0x1f };
krypto::aes<256, krypto::modes::ecb, krypto::pad::pkcs7> aes(key);

// input data
std::vector<unsigned char> plain_text = { some data };

// encrypt / decrypt 
const auto cipher = aes.encrypt(plain_text);
const auto plain_text = aes.decrypt(cipher);