encrypt and decrypt password

how do i encrypt and decrypt a password

Usually one doesn't decrypt a password, but checks to see if the encrypted password supplied is the same as the encrypted password stored in a file or other repository.

Encryption depends on what you are encrypting the password for and what encryption mechanism is uded.

the simpliest one-way encryption can be made with md5sum