So I have the user enter password to signup from the android app.
Before I save the password to the database on the server I want to convert it to a MD5 one way hash and save it to the database.
MessageDigest md = null;
try {
md = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e3) {
// TODO Auto-generated catch block
e3.printStackTrace();
}
try {
md.update(password.getBytes("UTF-8"));
} catch (UnsupportedEncodingException e3) {
// TODO Auto-generated catch block
e3.printStackTrace();
}
byte raw[] = md.digest();
How do I convert this byte array to a Base64 string. I saw in some forum that android util package left out the Base64 encoding and decoding on the other hand I see the encodetoString function in the android developers site.
Any help is appreciated.