I have tried to hash my password with perl when adding a user using a script but when I try to switch to that user, it says the password is incorrect. Here is what I wrote:
hidden=$(perl -e 'print crypt($pass, "salt"),"\n")
useradd -m -p $hidden -d /home/$user -s /bin/bash $user
And above this I attributed "pass" my new password and "user" my new username.