Encryption/Decryption Functions

The Initial Vector (IV) is used to “scramble” the data before encryption. It changes the bytes of the first block encrypts that, then uses that block to change the bytes of the second block, and so on. Every time you encrypt, you should choose a new IV so there is no way to tell if two encrypted strings are actually the same.

To decrypt, you will need to use the same IV used to encrypt so you should store it alongside the encrypted string.

I gave a talk on this at XDC that outlines the basics of encryption. It might be worth a look:

8 Likes