Here you can find the source of getKeyBytes(String key)
public static byte[] getKeyBytes(String key) throws NoSuchAlgorithmException
//package com.java2s; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { /**//www.j a v a 2 s . co m * convert key from string to 256-bits (32-bytes) bytes */ public static byte[] getKeyBytes(String key) throws NoSuchAlgorithmException { MessageDigest md5 = MessageDigest.getInstance("md5"); byte[] k1 = md5.digest(key.substring(0, key.length() / 2) .getBytes()); byte[] k2 = md5.digest(key.substring(key.length() / 2).getBytes()); byte[] k = new byte[32]; for (int i = 0; i < 16; i++) { k[i] = k1[i]; k[16 + i] = k2[i]; } return k; } }