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