Java tutorial
//package com.java2s; //License from project: Apache License import java.security.SecureRandom; import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; public class Main { public static final String KEY_ALGORITHM = "AES"; public static byte[] getRandomKey(byte[] seed) throws Exception { KeyGenerator kg = KeyGenerator.getInstance(KEY_ALGORITHM); SecureRandom sr = SecureRandom.getInstance("SHA1PRNG"); //random sr.setSeed(seed); kg.init(128, sr); SecretKey secretKey = kg.generateKey(); return secretKey.getEncoded(); } }