1

Can anyone tell my how this guy, who gives the code example, is able to use byte?

Example of AES using Crypto++

Like this line:

byte key[ CryptoPP::AES::DEFAULT_KEYLENGTH ], iv[ CryptoPP::AES::BLOCKSIZE ];

and

std::cout << "0x" << std::hex << (0xFF & static_cast<byte>(ciphertext[i])) << " ";

I tried copy-paste, but I can't create byte variables.

John Kugelman
  • 349,597
  • 67
  • 533
  • 578
Kuno Heltborg
  • 79
  • 1
  • 7

2 Answers2

0

You have do define that like this

typedef unsigned char byte;

because the char type doesen't reach decimal value 255 so you have to define an unsigned char type. Anyway it works

0

The type "byte" is defined in some of the header files that is included in the example. To use exactly the same type, you have to include the same header files.

rbf
  • 541
  • 4
  • 16