List of utility methods to do Digest
String | digest(String provider, File file, int radix) Digest a file with a specified provider. String result; BufferedInputStream bis = null; try { MessageDigest messageDigest = MessageDigest.getInstance(provider); bis = new BufferedInputStream(new FileInputStream(file)); byte[] buffer = new byte[8192]; int n; while ((n = bis.read(buffer)) != -1) ... |
String | digest(String raw, String algorithm) digest if (raw == null || "".equals(raw)) return ""; MessageDigest md; try { md = MessageDigest.getInstance(algorithm); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); md.update(raw.getBytes()); StringBuilder sb = new StringBuilder(); for (byte b : md.digest()) { String hex = String.format("%02x", b); sb.append(hex); return sb.toString(); |
String | digest(String s, String algorithm) Computes digest of given input String. int i; MessageDigest md = MessageDigest.getInstance(algorithm); byte[] hash = md.digest(s.getBytes()); StringBuilder sb = new StringBuilder(2 * hash.length); for (i = 0; i < hash.length; i++) { int b = hash[i] & 0xff; if (b < 16) { sb.append('0'); ... |
byte[] | digest(String source) digest MessageDigest md = MessageDigest.getInstance("SHA1"); md.update(source.getBytes()); return md.digest(); |
String | digest(String source, byte[] salt) digest try { return new String(encode(digest(source.getBytes(DEFAULT_ENCODING), salt))); } catch (UnsupportedEncodingException ex) { throw new RuntimeException("PasswordCrypter's error has occured!", ex); } catch (RuntimeException ex) { throw ex; |
String | digest(String source, String algorythm) digest if (source == null || source.length() == 0) { return source; try { StringBuilder result = new StringBuilder(); MessageDigest md = MessageDigest.getInstance(algorythm); byte[] bytes = md.digest(source.getBytes("UTF-8")); for (byte b : bytes) { ... |
String | digest(String strSource) digest StringBuffer digest = new StringBuffer(); java.security.MessageDigest md = java.security.MessageDigest.getInstance("SHA"); byte[] sourBytes = strSource.getBytes(); byte[] digestBytes = md.digest(sourBytes); if (digestBytes != null) { for (int i = 0, n = digestBytes.length; i < n; i++) { digest.append(digestBytes[i]); return digest.toString(); |
String | digest(String strSrc, String encName) digest MessageDigest md = null; String strDes = null; byte[] bt = strSrc.getBytes(); try { if (encName == null || encName.equals("")) { encName = "MD5"; md = MessageDigest.getInstance(encName); ... |
String | digest(String text) digest MessageDigest algorithm = null; StringBuilder sig = new StringBuilder(); try { algorithm = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException exc) { throw new RuntimeException(exc); algorithm.reset(); ... |
String | digest(String text, String algorithm) Create the hash/digest code for a given text. if (text == null) { throw new IllegalArgumentException(new NullPointerException()); MessageDigest md; try { md = MessageDigest.getInstance(algorithm); } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException(e); ... |