0

This is my Code in java.Here I am converting a string to byte array and heaping it using MD algorithm with the Help of digest in java.

public static byte[] passwordToKey (String password) {

    MessageDigest md = null;
    try {
        md = MessageDigest.getInstance ("MD5");
    } catch (NoSuchAlgorithmException ex) {
        return new byte[0];
    }
    byte[] passwordBytes = null;
    try {
        passwordBytes = password.getBytes ("ISO-8859-1");
    } catch (UnsupportedEncodingException ex) {
        passwordBytes = new byte[0];
    }
    return md.digest(passwordBytes);
}

The problem is the value after encryption in java and ios are different.Can someone give me the exact code in ios for the above?

0 Answers0