Java SHA shaHash(String message)

Here you can find the source of shaHash(String message)

Description

sha Hash

License

Open Source License

Declaration

public static String shaHash(String message) throws NoSuchAlgorithmException 

Method Source Code


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

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class Main {
    public static String shaHash(String message) throws NoSuchAlgorithmException {
        MessageDigest md = MessageDigest.getInstance("SHA-512");
        byte[] hash = new byte[0];
        hash = md.digest(message.getBytes());

        StringBuilder sb = new StringBuilder(2 * hash.length);

        for (byte b : hash)
            sb.append(String.format("%02x", b & 0xff));

        return sb.toString();
    }/*from   w w  w  .  java2  s . c om*/
}

Related

  1. sha2(String... data)
  2. sha5Encode(byte[] content)
  3. SHA_1(byte[] input)
  4. shaFile(String paramString)
  5. SHAHash(byte[] input)
  6. shaPsw(String inputText)
  7. SHAsum(byte[] convertme)
  8. SHAsum(byte[] convertme, boolean prefix, boolean uppercase)
  9. SHAsum(byte[] input)