It is, assuming that the hash is of the complete string. Look what happens when you use a password hasher that only uses the first 8 characters of its input (this is the 'traditional' (salted) Unix password hash function):
$ mkpasswd -s -S 00 <<<salt.password
002y63GMEzTFg
$ mkpasswd -s -S 00 <<<salt2.password
00OHzu67zQp/Q
Good: those two are different.
$ mkpasswd -s -S 00 <<<password.salt
00xQPHYlVDIw6
$ mkpasswd -s -S 00 <<<password.salt2
00xQPHYlVDIw6
Oops.
Note above that I'm passing a fixed salt to mkpasswd
; this is so that its randomly-generated salt doesn't interfere with the principle I'm demonstrating with salt
and salt2
prepended or appended to the password.
N.B. I'm not suggesting that anybody actually use the old crypt()
function for hashing passwords - partly down to the truncation problem shown here, but also because the salt is much too short, the resultant hash is too short, and the algorithm is much too fast for today's hardware (a password hash function needs to be slow, to hinder cracking, but not so slow that it frustrates legitimate users).