Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

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. (

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 ); 

share|improve this question

marked as duplicate by Conrado PLG, poncho, e-sushi, Gilles, rath Aug 24 '13 at 3:17

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 4 down vote accepted

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.

share|improve this answer
I like this article too. – christo8989 Feb 9 at 17:27

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