It's possible, but that's not how I'd do it. Typically passwords should not be stored; rather, a 1-way hash of the password should be stored. Then you can just hash any passwords entered later and compare the hashes.