Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am taking a cryptography class and our first homework is to implement a 32-bit

ID: 647620 • Letter: I

Question

I am taking a cryptography class and our first homework is to implement a 32-bit block cipher. I implemented a simple block-cipher that uses CBC. Currently, my implementation reads both the 32-bit IV and the 32-bit key from a key file.

However, I read that the initialization vector is generated randomly, and can be public as well. If I changed my algorithm to generate a random IV, where would I store this IV (or communicate it to the user)? Would I simply output the value of the IV to the user after I finish encrypting the message? Or could I store the initialization vector as part of the message itself (perhaps at the beginning).

Then my decryption algorithm can simply read the first 32-bits of the encrypted message, which will be the initialization vector. Is this the right way to do it?

Explanation / Answer

For CBC encryption, you would store the initialization vector as the beginning of
the ciphertext, regardless of whether you read in an IV or generated it yourself.
The CBC decryption algorithm would do what you described at the end of your post.
Your implementation should also offer access to the block cipher itself, without any mode of operation

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote