Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

how to save password in encrypted/Decrypted format

 
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
 
Rancher
Posts: 43016
76
  • 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.
 
Ranch Hand
Posts: 781
Netbeans IDE Ubuntu Java
  • 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
 
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
 
keep an eye out for scorpions and black widows. But the tiny ads are safe.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic