List of utility methods to do SHA1
String | sha1ByString(String str) SHA1 digest try { if (isBlank(str)) { return null; MessageDigest md = java.security.MessageDigest.getInstance("SHA-1"); md.update(str.getBytes("UTF-8")); byte tmp[] = md.digest(); StringBuilder sb = new StringBuilder(); ... |
byte[] | SHA1Checksum(String filename) Calculate a SHA1 checksum of a file InputStream fis = new FileInputStream(filename); byte[] buffer = new byte[1024]; MessageDigest complete = MessageDigest.getInstance("SHA1"); int numRead; while ((numRead = fis.read(buffer)) != -1) { complete.update(buffer, 0, numRead); fis.close(); ... |
byte[] | sha1Digest(byte[] bytes) sha Digest return digest(SHA1_ALGORITHM_NAME, bytes);
|
byte[] | sha1Digest(byte[] bytes) sha Digest MessageDigest digest = MessageDigest.getInstance("SHA-1"); digest.update(bytes); return digest.digest(); |
byte[] | sha1Digest(final InputStream data) sha Digest MessageDigest digest = getSHA1MessageDigest();
updateMessageDigest(digest, data);
return digest.digest();
|
byte[] | sha1Digest(String src) sha Digest try { MessageDigest md = MessageDigest.getInstance("SHA-1"); return md.digest(src.getBytes("UTF8")); } catch (Exception e) { return null; |
String | sha1DigestAsHex(String data) Returns the SHA1 of the provided data byte[] dataBytes = getDigest("SHA").digest(data.getBytes(UTF8_CHARSET)); return new String(encodeHex(dataBytes)); |
byte[] | sha1Encode(byte[] content) sha Encode MessageDigest md = MessageDigest.getInstance("SHA"); byte[] mdRes = md.digest(content); return mdRes; |
String | SHA1Encode(String sourceString) SHA Encode String resultString = null; try { resultString = new String(sourceString); MessageDigest md = MessageDigest.getInstance("SHA-1"); resultString = byte2hexString(md.digest(resultString.getBytes())); } catch (Exception ex) { return resultString; ... |
MessageDigest | sha1Hash() sha Hash return MessageDigest.getInstance("SHA-1"); |