List of utility methods to do SHA1
String | sha1(String s) sha try { MessageDigest digest = MessageDigest.getInstance("SHA-1"); digest.update(s.getBytes()); byte messageDigest[] = digest.digest(); StringBuffer hexString = new StringBuffer(); for (int i = 0; i < messageDigest.length; i++) { hexString.append(Integer.toHexString((0xFF & messageDigest[i]) | 0x100).substring(1)); return hexString.toString(); } catch (NoSuchAlgorithmException e) { return ""; |
String | sha1(String s) sha try { MessageDigest md = MessageDigest.getInstance("SHA-1"); md.update(s.getBytes()); return bytes2hex(md.digest()); } catch (Exception ex) { ex.printStackTrace(); return null; ... |
String | sha1(String s) sha return digest(s, DIGEST_SHA1);
|
String | sha1(String s) sha MessageDigest md = null; try { md = MessageDigest.getInstance("SHA1"); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("sha1 not supported by plattform"); try { byte[] result = md.digest(s.getBytes("UTF-8")); ... |
String | sha1(String s) sha MessageDigest mDigest; try { mDigest = MessageDigest.getInstance("SHA1"); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); byte[] result = mDigest.digest(s.getBytes()); StringBuffer sb = new StringBuffer(); ... |
String | sha1(String s) sha MessageDigest md = getMessageDigest("sha-1"); return bytes2HexString(md.digest(s.getBytes(StandardCharsets.UTF_8))); |
String | sha1(String s) Computes the SHA1 sum of the given string. try { return byteArrayToHexString(MessageDigest.getInstance("SHA").digest(s.getBytes("US-ASCII"))); } catch (NoSuchAlgorithmException | UnsupportedEncodingException nsae) { throw new RuntimeException(nsae); |
String | sha1(String src) Calculates the SHA-1 digest and returns the value as a 40 character hex string. try { md = MessageDigest.getInstance("SHA"); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); md.update(src.getBytes(StandardCharsets.UTF_8)); return String.format("%040x", new BigInteger(1, md.digest())); |
String | sha1(String src) sha MessageDigest md = MessageDigest.getInstance("SHA1"); byte[] hashBytes = md.digest(src.getBytes()); BASE64Encoder b64e = new BASE64Encoder(); String hash = b64e.encode(hashBytes); return hash; |
String | sha1(String src) sha MessageDigest md1 = null; try { md1 = MessageDigest.getInstance("SHA-1"); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); try { md1.update(src.getBytes("UTF-8")); ... |