Take the 2-minute tour ×
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

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

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

add comment

1 Answer 1

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
add comment

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