What you do here is hashing , not encryption .
Hashing has the goal of not storing the password itself in the database, so if the database is stolen, the attacker will not recognize all user passwords.
Hashing should be used in conjunction with salting hashes, because otherwise an attacker who gained access to the database to crack weak passwords stored there.
, ( md5 sha1) - .