List of utility methods to do SHA1
String | sha1(String srcStr) sha return hash("SHA-1", srcStr); |
String | SHA1(String str) SHA return encrypt(str, "SHA1"); |
String | SHA1(String str) SHA MessageDigest mDigest = MessageDigest.getInstance("SHA-1"); mDigest.reset(); mDigest.update(str.getBytes("UTF-8")); Formatter f = new Formatter(); for (byte b : mDigest.digest()) f.format("%02x", b); return f.toString(); |
String | sha1(String str) sha if (str == null || str.length() == 0) { return null; char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; try { MessageDigest mdTemp = MessageDigest.getInstance("SHA1"); mdTemp.update(str.getBytes()); byte[] md = mdTemp.digest(); ... |
String | sha1(String str) sha try { MessageDigest md = MessageDigest.getInstance("SHA-1"); md.update(str.getBytes()); byte[] b = md.digest(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < b.length; i++) { int v = (int) b[i]; v = v < 0 ? 0x100 + v : v; ... |
String | sha1(String str) sha MessageDigest sha = MessageDigest.getInstance("SHA"); sha.update(str.getBytes("utf8")); byte[] bytes = sha.digest(); StringBuilder ret = new StringBuilder(bytes.length << 1); for (int i = 0; i < bytes.length; i++) { ret.append(Character.forDigit((bytes[i] >> 4) & 0xf, 16)); ret.append(Character.forDigit(bytes[i] & 0xf, 16)); return ret.toString(); |
byte[] | sha1(String str) Calculate a SHA-1 hash from the specified string. try { MessageDigest sha1 = MessageDigest.getInstance("SHA-1"); return sha1.digest(str.getBytes(Charset.forName("UTF-8"))); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("Must support SHA-1", e); |
String | sha1(String str) sha try { MessageDigest md = MessageDigest.getInstance("SHA-1"); byte[] bytes = md.digest(str.getBytes("utf-8")); StringBuilder sb = new StringBuilder(bytes.length * 2); for (int i = 0; i < bytes.length; i++) { sb.append(String.format("%02x", bytes[i])); return sb.toString(); ... |
String | sha1(String str) sha try { StringBuffer sb = new StringBuffer(); MessageDigest md = MessageDigest.getInstance("sha1"); md.update(str.getBytes()); byte[] msg = md.digest(); for (byte b : msg) { sb.append(String.format("%02x", b)); return sb.toString(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); return null; |
String | sha1(String str) sha String sha1 = encode(str, "SHA-1"); return sha1; |