Have a look at man 5 shadow and man 3 crypt. From the latter, you can learn that password hashes in /etc/shadow have the following form:
 $id$salt$encrypted
 where id defines the type of encryption and, reading further, can be one of
          ID  | Method
          ---------------------------------------------------------
          1   | MD5
          2a  | Blowfish (not in mainline glibc; added in some
              | Linux distributions)
          5   | SHA-256 (since glibc 2.7)
          6   | SHA-512 (since glibc 2.7)
 Depending on the type of hash, you need to use the appropriate function/tool for generating and verifying the password "by hand". If the system contains mkpasswd program, you can use it as suggested hereas suggested here. (You take the salt from the shadow file, if that wasn't  obvious.) For example, with md5 passwords :
 mkpasswd -5 <the_salt> <the_password>
 will generate the string that should match /etc/shadow entry.