The password utility uses what's there in the shadow file. Your password string in that file consists of 3 elements:
- hashing algorithm
- hashed password
These elements are separated by "$" characters, like this: $hashing_algorithm$salt$password_hash
In Slackware, the hashing algorithm has the value "1" which means (a variant of) MD5. Some other distros have "6" which means blowfish.
The salt string is randomly generated when you create/change your password.
The password hash (the 3rd element) is then calculated using the salt and your actual password when you type it in, using the specific hashing algorithm.
Check your password hash in your local shadow file. Write down the salt string. Then try this command:
openssl passwd -1 -salt salt_string your_actual_password
and compare the result to the password hash stored in the shadow file. Should be the same!
This is how login works. The password tool takes your plaintext password and calculates the hash using the algorithm and hash which are stored with your hashed password. If the result of that calculation matches what's present in the shadow file, then you typed the correct password and you are allowed in. The algorithm is one-way, you can not recover the plaintext password from the data in the shadow file.
This is why you can just copy/paste a line in the shadow file from one computer to another, it will still work there.