4

I am aware of the benefits of adding a salt to values that are hashed using a one-way function. Is adding a salt to a value that is being encrypted (using symmetric encryption) considered to be good practice as well?

The salt (unlike the encryption key) is likely to be stored in the same data source as the encrypted data. I'm wondering if this adds a weakness, rather than improve security (for example: by making it possible to decipher the encryption key).

2
  • 5
    Is this not what an Initialisation Vector is for?
    – lynks
    May 14, 2013 at 11:56
  • Why exactly would you salt what you encrypted. The entire point of encrypting data is to decrypt it.
    – Ramhound
    May 14, 2013 at 15:39

3 Answers 3

10

A salt is a cryptographically-secure random non-repeating value, added to the password before hashing it, rendering rainbow tables useless and making it impossible to attack more than one password by attacking one hash.

An initialization vector (IV) is a cryptographically-secure random non-repeating value added as the initial state to a block cipher algorithm depending on the mode of operation, preventing the cipher from producing the same ciphertext for similar blocks of the plaintext, thus denying the attacker the opportunity to infer relationships between segments of the encrypted message.

Both a salt and an IV aren't secret information, in fact, in most cases the IV is transported with the message itself. Implemented correctly, an IV shouldn't make it any easier to "crack" the encryption. On the contrary, it should make it even harder. The security of the cipher system should depend on the secrecy of key, and only on the secrecy of the key, AKA Kerckhoffs's principle:

That the security of a cipher system should depend on the key

Oh, also, don't implement your own crypto and use it in a production environment, AKA Don't be a Dave.

3

A salt has absolutely no benefit for encryption. If anything, it could (though it shouldn't) make the encryption less secure. If it turns out that a known plaintext attack is found (an attack that allows information to be gained from a cypher text about the key by knowing part of the plain text) then having a public value encrypted would make every message weak to that type of attack.

It's also worth pointing out that you don't "hash using a one-way function". A hash IS a one way function. The (somewhat simplified) point of a salt is to complicate the input so that an attacker can't pre-generate values for common passwords or values and simply look up what the value that went in to the hash, effectively leveraging a prior attack against future attacks. A salt makes it so that effort has to be performed for every attack.

1

I am aware of the benefits of adding a salt to values that are hashed using a one-way function. Is adding a salt to a value that is being encrypted (using symmetric encryption) considered to be good practice as well?

I think your approach is flawed and will weaken the integrity of the cipher it self. By appending the salt with the plaintext that is going to be encrypted we are subjecting to known plaintext attack.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .