# Are password salts equivalent to keystream?

I was reading up on keystream when I came upon the definition of it:

A keystream is a stream of random or pseudorandom characters that are combined with a plaintext message to produce an encrypted message (the ciphertext).

The "characters" in the keystream can be bits, bytes, numbers or actual characters like A-Z depending on the usage case.

I am wondering conceptually if the stream of random pseudorandom character is equivalent to a salt which are commonly appended to passwords?

No, they are not conceptually related.

A keystream is the output of a stream cipher and is of (effectively, for modern ciphers) infinite length. If you need to encrypt more plaintext, you use the cipher to produce more bytes of keystream.

On the other hand, password salts are of fixed size and their purpose is to make every password effectively unique. A simplification is that if two people have the passwords password but different salts, one password might be hashed as if it were passwordxSFsz8sl while the other is hashed as if it was passwordRsRb58yd. Without this protection, an attacker could (for instance) hash the 100,000 most common passwords and compare them to all of the hashes in your database. With salts, an attacker can't share this work between users in the database; to try those same 100,000 passwords, s/he must compute all 100,000 for every user in the database.

A much closer analogue of password salts is an initialization vector (or IV), used in encryption. Their purpose is very similar; they ensure that each instance of a cipher will encrypt the plaintexts differently so that even two identical plaintexts will encrypt to a unique ciphertext.

The salt isn't key, it wasn't a secret. In the original UNIX password encryption a 12 bit number derived from rand() calls was used to transpose the first 12 and the third 12 entries in a copy of the DES algorithm's E Permutation table.

The salt was store in the password field of the password file, the trailing two characters, each one of a set of 64 printable characters.

The DES algorithm used the password as key starting with a plaintext of all '0's and encrypting data block value for 25 DES repetitions. The 64 bit result block was stored as 11 characters of the same 64 character set, followed by the two salt characters as the password field entry.

The 25 repetitions were to increase the computational workload for software password attacks. Modifying the E Permutation prevents the use of existing silicon (hardware) DES implementations in password attacks.

The idea is that reproducing the hash stored in the password file would require brute force or the original password.

Eventually due to Moore's law speeding up processors and faster software implementations readable password hashes were first hidden by shadow password files then eventually other 'harder' algorithms became commonly used.