Java Hash Calculate getHash(String input)

Here you can find the source of getHash(String input)

Description

get Hash

License

Open Source License

Declaration

public static String getHash(String input) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String getHash(String input) {
        input += "vkoqasnm";
        try {/*  ww  w.  j  a va  2  s  . c om*/
            java.security.MessageDigest md = java.security.MessageDigest.getInstance("SHA-1");
            byte[] array = md.digest(input.getBytes());
            StringBuffer sb = new StringBuffer();
            for (int i = 0; i < array.length; ++i) {
                sb.append(Integer.toHexString((array[i] & 0xFF) | 0x100).substring(1, 3));
            }
            return sb.toString();
        } catch (java.security.NoSuchAlgorithmException e) {
            throw new RuntimeException(e);
        }
    }
}

Related

  1. getHash(String algorithm, int i)
  2. getHash(String credentials)
  3. getHash(String Data)
  4. getHash(String fileName, String hashType)
  5. getHash(String givenStr)
  6. getHash(String input)
  7. getHash(String key)
  8. getHash(String message)
  9. getHash(String pass, String algorithm)