Hi, is there a way to convert this java function to b4a. I converted in library an tested in 7.01.
my knowledge of java its low to mediun. in the library converted not work.
thanks.
victor
my knowledge of java its low to mediun. in the library converted not work.
thanks.
victor
B4X:
public static String Encriptar(String texto,String clave) {
String secretKey = clave;
String base64EncryptedString = "";
try {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] digestOfPassword = md.digest(secretKey.getBytes("utf-8"));
byte[] keyBytes = Arrays.copyOf(digestOfPassword, 24);
SecretKey key = new SecretKeySpec(keyBytes, "DESede");
Cipher cipher = Cipher.getInstance("DESede");
cipher.init(Cipher.ENCRYPT_MODE, key);
byte[] plainTextBytes = texto.getBytes("utf-8");
byte[] buf = cipher.doFinal(plainTextBytes);
byte[] base64Bytes = Base64.encodeBase64(buf);
base64EncryptedString = new String(base64Bytes);
} catch (Exception ex) {
}
return base64EncryptedString;
}