java DES

public static byte[] encryptProcess(String paramString) throws Exception {

Cipher localCipher = Cipher.getInstance("DES/CBC/PKCS5Padding");

DESKeySpec localDESKeySpec = new DESKeySpec("key".getBytes("UTF-8"));//字符串

localCipher.init(1, SecretKeyFactory.getInstance("DES").generateSecret(localDESKeySpec), new IvParameterSpec(new byte[] { })); 8位byte

return localCipher.doFinal(paramString.getBytes("UTF-8"));
}

posted @ 2016-05-26 17:25  耀yao  阅读(226)  评论(0编辑  收藏  举报