Made the whole thing MUCH more secure, by adding an IV (initialization vector), implemeted RRKM (rolling round key mode) and redone key extrapolation

This commit is contained in:
Leonetienne
2022-02-06 21:54:43 +01:00
parent e57456e9ae
commit 8678d3cb1b
18 changed files with 427 additions and 65 deletions

View File

@@ -65,7 +65,7 @@ GhettoCipher::Flexblock GhettoCipher::Cipher::Encipher(const Flexblock& data, bo
std::cout << "Encrypting... (Block " << i << " / " << blocks.size() << " - " << ((float)i*100 / blocks.size()) << "%)" << std::endl;
const Block& lastBlock = (i>0) ? blocks[i-1] : initializationVector;
blocks[i] = feistel.Encipher(blocks[i] ^ lastBlock);
blocks[i] = feistel.Encipher(blocks[i] ^ lastBlock); // Xor last cipher block with new clear text block before E()
}
// Concatenate ciphertext blocks back into a flexblock
@@ -101,7 +101,7 @@ GhettoCipher::Flexblock GhettoCipher::Cipher::Decipher(const Flexblock& data, bo
Block tmpCopy = blocks[i];
blocks[i] = feistel.Decipher(blocks[i]) ^ lastBlock;
blocks[i] = feistel.Decipher(blocks[i]) ^ lastBlock; // Decipher cipher block [i] and then xor it with the last cipher block [i-1] we've had
lastBlock = std::move(tmpCopy);
}