K
kebabkongen
Hi,
I am working on a Java application where I need to store encrypted
passwords in a database.
So far I have a password which I have encrypted using MessageDigest
class as below:
/*
* encrypt password
*/
try{
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(password.getBytes());
byte[] hashedPwd = md.digest();
kryptPwd = new String(hashedPwd);
}catch (Exception e){
System.out.println(e);
}
This returns a encrypted password, but the String that is returned has
very strange characters which I beleive will introduce a lot of
problems when storing it in the database (when later
comparing/verifying the encrypted passwords using SQL).
I have noticed that stored passwords in Oracle database having "normal
characters" (as A-Z and 0-9). Is there some normal procedure of how to
convert the digested password to a more "database friendly" format?
Regards, Per Magnus
I am working on a Java application where I need to store encrypted
passwords in a database.
So far I have a password which I have encrypted using MessageDigest
class as below:
/*
* encrypt password
*/
try{
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(password.getBytes());
byte[] hashedPwd = md.digest();
kryptPwd = new String(hashedPwd);
}catch (Exception e){
System.out.println(e);
}
This returns a encrypted password, but the String that is returned has
very strange characters which I beleive will introduce a lot of
problems when storing it in the database (when later
comparing/verifying the encrypted passwords using SQL).
I have noticed that stored passwords in Oracle database having "normal
characters" (as A-Z and 0-9). Is there some normal procedure of how to
convert the digested password to a more "database friendly" format?
Regards, Per Magnus