Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to save password in encrypted/Decrypted format

 
raj jaiswal
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi


I want to save password in encrypted/Decrypted format in database.How to do that..
Please some help me to do this.



Thanks
Rajjaiswal
MCA SCJP1.6
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Encrypting a password merely transform the problem of protecting passwords to the problem of protecting the encryption key - which is not substantially different.

What one usually does instead is to hash (or digest) passwords using an algorithm like SHA-2 (or SHA-256, as it's called in the Java world), thus ensuring that passwords can never be recovered.
 
James Sabre
Ranch Hand
Posts: 781
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:an algorithm like SHA-2 (or SHA-256, as it's called in the Java world)


SHA2 denotes the family SHA-256, SHA-384 and SHA-512 and not just SHA-256. All are available in the JRE.
 
raj jaiswal
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi


Actually i dont know any things about SHA-256 .Please give some example so that i can understand better.

thanks
 
Mathieu Fortin
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Usually you want one way encryption with passwords. Look into the java.security.MessageDigest class.

Some pseudo code:


Mathieu
http://simpleadn.blogspot.com
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic