Java tutorial
//package com.java2s; import javax.crypto.Cipher; import javax.crypto.SecretKey; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.DESKeySpec; public class Main { public static String deCrypto(String txt, String key) { SecretKeyFactory skeyFactory = null; Cipher cipher = null; byte[] btxts = null; try { DESKeySpec desKeySpec = new DESKeySpec(key.getBytes()); skeyFactory = SecretKeyFactory.getInstance("DES"); cipher = Cipher.getInstance("DES"); SecretKey deskey = skeyFactory.generateSecret(desKeySpec); cipher.init(Cipher.DECRYPT_MODE, deskey); btxts = new byte[txt.length() / 2]; for (int i = 0, count = txt.length(); i < count; i += 2) { btxts[i / 2] = (byte) Integer.parseInt(txt.substring(i, i + 2), 16); } return (new String(cipher.doFinal(btxts))); } catch (Exception e) { e.printStackTrace(); } return null; } }