Java tutorial
//package com.java2s; import java.security.SecureRandom; import javax.crypto.KeyGenerator; public class Main { private static byte[] getRawKey(byte[] paramArrayOfByte) throws Exception { KeyGenerator localKeyGenerator = KeyGenerator.getInstance("AES"); SecureRandom localSecureRandom = SecureRandom.getInstance("SHA1PRNG", "Crypto"); localSecureRandom.setSeed(paramArrayOfByte); localKeyGenerator.init(128, localSecureRandom); return localKeyGenerator.generateKey().getEncoded(); } }