How can i encrypt "String" which present a Password

i have a String which present password, how can i encrypt the password while i save it to an XML file and how i decipher the password when i load it from the XML file.Thanks
[187 byte] By [deviancea] at [2007-11-27 8:28:12]
# 1
You don't generally encrypt passwords. You simply hash them. There should rarely, if ever, be a reason to decrypt a password. http://java.sun.com/j2se/1.4.2/docs/guide/security/CryptoSpec.html http://java.sun.com/j2se/1.4.2/docs/guide/security/jce/JCERefGuide.html
jverda at 2007-7-12 20:18:05 > top of Java-index,Java Essentials,Java Programming...
# 2
in the past when i wanted to make a password non-human readable, i would base64 encode it. this is not encryption in any sense of the word, though.
mkoryaka at 2007-7-12 20:18:05 > top of Java-index,Java Essentials,Java Programming...
# 3
The API already includes tools to perform MD5 hashing which is pretty common.
Dalzhima at 2007-7-12 20:18:05 > top of Java-index,Java Essentials,Java Programming...
# 4
where is that API at?
den2681a at 2007-7-12 20:18:05 > top of Java-index,Java Essentials,Java Programming...
# 5
http://java.sun.com/javase/6/docs/api/java/security/MessageDigest.html
Dalzhima at 2007-7-12 20:18:05 > top of Java-index,Java Essentials,Java Programming...