IV pin for CBC chaining mode
NIST Special Publication 800-38a discusses methods for generating an IV in Appendix C. One suggested method is to use a counter or nonce, encrypt it, and use the result as an IV. In contrast, for example, in CTR mode, it is necessary that the potential adversary cannot predict the IV.
Attacks exist if predictable IVs are used. See, for example, this document . (I will try to find a more accessible version).
source to share
Anything that never repeats and has no structure will work (I don't understand why unpredictability should be important - if messages are also authenticated (which they should be)).
If you know you will never send more than one message per second, you can use unixtime (hash and use the first bytes).
If you are running on multiple threads / processes / machines, you may need to enable threadid / processid / machineid.
If you have access to generating the GUID, hashing that and using the first 8 bytes might also be a good option.
source to share