You can also get a hashed password, identify the hashing algorithm, and verify the password. The below example is for Argon2PasswordHasher, a similar approach to the above code sample can be used for all the other algorithms.

A good practice is to verify if the password is using the default algorithm, and update the password if necessary on the database. Every hashing algorithm has an algorithm name. You can pass it in and check if updates are required:

consthashers=require('node-django-hashers');
consthash_password="286755fad04869ca523320acce0dc6a4"; // "password" in md5constmustUpdate=hashers.mustUpdateHashedPassword(hash_password, "pbkdf2_sha256");
// mustUpdate is true since we do not want MD5 hash passwords, pbkdf2_sha256 is the defaultconsthash_algorithm=hashers.getHasher("pbkdf2_sha256");
// update the users password in the database by re encoding the password here