@Test public void testDigest() { byte[] data = "aaa".getBytes(); String result = MD5.digest(data); assertEquals(result, "47bce5c74f589f4867dbd57e9ca9f808"); }
public static String digest(byte[] bytes) { try { MessageDigest md = MessageDigest.getInstance(ISecurity.MD5_ALGORITHM); BigInteger bigInteger = new BigInteger(md.digest(bytes)); return bigInteger.toString(16); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("无此[" + ISecurity.MD5_ALGORITHM + "]算法", e); } }
MD5 { public static String digest(byte[] bytes) { try { MessageDigest md = MessageDigest.getInstance(ISecurity.MD5_ALGORITHM); BigInteger bigInteger = new BigInteger(md.digest(bytes)); return bigInteger.toString(16); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("无此[" + ISecurity.MD5_ALGORITHM + "]算法", e); } } }
MD5 { public static String digest(byte[] bytes) { try { MessageDigest md = MessageDigest.getInstance(ISecurity.MD5_ALGORITHM); BigInteger bigInteger = new BigInteger(md.digest(bytes)); return bigInteger.toString(16); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("无此[" + ISecurity.MD5_ALGORITHM + "]算法", e); } }  }
MD5 { public static String digest(byte[] bytes) { try { MessageDigest md = MessageDigest.getInstance(ISecurity.MD5_ALGORITHM); BigInteger bigInteger = new BigInteger(md.digest(bytes)); return bigInteger.toString(16); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("无此[" + ISecurity.MD5_ALGORITHM + "]算法", e); } }  static String digest(byte[] bytes); }
MD5 { public static String digest(byte[] bytes) { try { MessageDigest md = MessageDigest.getInstance(ISecurity.MD5_ALGORITHM); BigInteger bigInteger = new BigInteger(md.digest(bytes)); return bigInteger.toString(16); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("无此[" + ISecurity.MD5_ALGORITHM + "]算法", e); } }  static String digest(byte[] bytes);  }