Java Utililty Methods SHA1

List of utility methods to do SHA1

Description

The list of methods to do SHA1 are organized into topic(s).

Method

Stringsha1(String str)
sha
MessageDigest md;
try {
    md = MessageDigest.getInstance("sha1");
    md.update(str.getBytes());
    byte[] hash = md.digest();
    return toHexString(hash);
} catch (Exception e) {
    e.printStackTrace();
...
Stringsha1(String string)
sha
return calcHash(string, "SHA-1");
byte[]sha1(String string)
Hashes the given string using the SHA-1 algorithm.
return hash("SHA-1", string);
StringSHA1(String strs)
SHA
byte[] _bytes = null;
try {
    MessageDigest md = MessageDigest.getInstance("SHA");
    md.update(strs.getBytes());
    _bytes = md.digest();
} catch (NoSuchAlgorithmException ex) {
return new BigInteger(1, _bytes).toString(16);
...
Stringsha1(String text)
sha
MessageDigest md = null;
String outStr = null;
try {
    md = MessageDigest.getInstance("SHA-1");
    byte[] digest = md.digest(text.getBytes());
    outStr = bytes2hex(digest);
} catch (NoSuchAlgorithmException e) {
    throw new RuntimeException(e);
...
StringSHA1(String text)
SHA
try {
    MessageDigest md;
    md = MessageDigest.getInstance("SHA-1");
    byte[] sha1hash = new byte[40];
    md.update(text.getBytes("iso-8859-1"), 0, text.length());
    sha1hash = md.digest();
    return convertToHex(sha1hash);
} catch (NoSuchAlgorithmException e) {
...
Stringsha1(String text)
sha
MessageDigest sha1 = MessageDigest.getInstance("SHA1");
byte[] digest = sha1.digest((text).getBytes());
return bytes2String(digest);
byte[]SHA1(String text)
SHA
try {
    MessageDigest md = MessageDigest.getInstance("SHA-1");
    md.update(text.getBytes("US-ASCII"), 0, text.length());
    return md.digest();
} catch (Throwable t) {
    throw new RuntimeException(t); 
byte[]SHA1(String text)
SHA
MessageDigest md;
md = MessageDigest.getInstance("SHA-1");
byte[] sha1hash = new byte[40];
md.update(text.getBytes(), 0, text.length());
sha1hash = md.digest();
return (sha1hash);
StringSHA1(String text)
SHA
try {
    MessageDigest md;
    md = MessageDigest.getInstance("SHA-1");
    byte[] md5hash = new byte[32];
    md.update(text.getBytes("iso-8859-1"), 0, text.length());
    md5hash = md.digest();
    return convertToHex(md5hash);
} catch (NoSuchAlgorithmException e) {
...