From Wikipedia I read that the IV is used to randomise the mapping of cleartext to cipher text and that the IV is usually stored (in cleartext) together with the encrypted record. (http://en.wikipedia.org/wiki/Initialization_vector)

However if I look at a specific implementation in C# when deriving the key using Rfc2898DeriveBytes, a salt value is required and I understand the need of the salt. But obviously I will need the salt later on the regenerate the key from my secret passphrase. Does that imply that the salt itself is not a secret and can be stored together with the encrypted record in cleartext, just like the IV?

string passphrase = "Hello World, I'm the secret!";
string salt = "13245678";

var deriveBytes = new Rfc2898DeriveBytes(passphrase, Encoding.UTF8.GetBytes(salt), 50000);

using (var rijndael = new RijndaelManaged())
    rijndael.KeySize = 256;
    rijndael.Key = deriveBytes.GetBytes ( rijndael.KeySize / 8 );
    rijndael.IV = deriveBytes.GetBytes ( rijndael.BlockSize / 8 ); 


The salt can be kept public.

All that matters is that the salt is available for you to use when it comes to re-deriving your password from some input guess.

In many ways, a salt performs the same function that an IV does for ciphers.

You can read more about salt and password hashing here.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.