Beispiel #1
0
 public static String _3DES_encode(byte[] key, byte[] data) {
   SecretKey deskey = new SecretKeySpec(key, "DESede");
   IvParameterSpec iv = new IvParameterSpec(Iv.getBytes());
   try {
     Cipher c1 = Cipher.getInstance(Transformation);
     c1.init(Cipher.ENCRYPT_MODE, deskey, iv);
     byte[] re = c1.doFinal(data);
     return Lang.fixedHexString(re);
   } catch (Exception e) {
     log.info("3DES FAIL?", e);
     e.printStackTrace();
   }
   return null;
 }
 /** 获取摘要, 同时MessageDigest也被重置了 */
 public String digest() {
   return Lang.fixedHexString(md.digest());
 }