How do I communicate the value of the initialization vector to the end user? Should it be part of the encrypted message? 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?
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.