Entry
Why can't I get ENCRYPT() to match identical passwords?
What is the effect of the salt in ENCRYPT()?
May 10th, 2000 20:01
Nathan Wallace, Tim Smith
Encrypt uses a "salt"; if you don't specify the salt, it'll pick one for
you (not the same one each time). So you need to specify the same salt
both when you encrypt and decrypt. The salt shows up as the first two
characters in the crypted password. So you could do:
select * from user where
password = encrypt('password', substring(password from 1 for 2))
You might want to look at the md5() function, too.