Java tutorial
//package com.java2s; import java.security.Key; import java.security.SecureRandom; import javax.crypto.KeyGenerator; public class Main { private static Key newDesInstance(String strKey) { Key key = null; try { KeyGenerator keyGenerator = KeyGenerator.getInstance("DES"); keyGenerator.init(new SecureRandom(strKey.getBytes())); key = keyGenerator.generateKey(); keyGenerator = null; } catch (Exception e) { e.printStackTrace(); } return key; } }