public static void main(String[] args) throws Exception { String deviceId = "0000000000000000"; // 机器码 String result_date = "2099-12-01"; String key = deviceId + "19860501"; String result = cal(result_date, key); System.out.println(result); } public static String cal(String data, String key) throws Exception { try { DESKeySpec dks = new DESKeySpec(key.getBytes()); SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES"); Key secretKey = keyFactory.generateSecret(dks); Cipher cipher = Cipher.getInstance("DES"); cipher.init(Cipher.ENCRYPT_MODE, secretKey); byte[] bytes = cipher.doFinal(data.getBytes()); return new BASE64Encoder().encode(bytes); } catch (Exception e) { throw new Exception(e); } }
[培训]科锐逆向工程师培训第53期2025年7月8日开班!