Ad

Where Can I Set The Number Of Rounds Of Key In Crypto++ (AES/CBC Mode)?

- 1 answer

Are the rounds of key already set in CBC mode(AES-128:10 rounds,AES-192:12 rounds,Aes-256:14 rounds) or is there other way to set the rounds of key? I've found setkeywithround(), but it doesn't seem to work with CBCmode. Below is the sample code I copied and modified from crypto++ wiki

void CBC_modified() {
    AutoSeededRandomPool prng;

    SecByteBlock key(32);
    SecByteBlock iv(AES::BLOCKSIZE);

    prng.GenerateBlock(key, key.size());
    prng.GenerateBlock(iv, iv.size());

    std::string plain = "CBC test mode";

    std::cout << "plain text: " << plain << endl<<endl;
    try
    {
        CBC_Mode< AES >::Encryption e;
        e.SetKeyWithIV(key, key.size(), iv);
Ad

Answer

Number of rounds of standard algorithms such as AES are predefined and I have never seen anybody change it. if you do so, it will be another algorithm and you will not be able to decrypt it with any standard version of algorithm.

Round of AES are like this:

  • AES-128 -> 10 round
  • AES-192 -> 12 round
  • AES-256 -> 14 round

BTW, rounds of algorithm is not related to its mode such as CBC.

Ad
source: stackoverflow.com
Ad