Java SHA512 SHA512(String original)

Here you can find the source of SHA512(String original)

Description

SHA

License

Open Source License

Declaration

public static String SHA512(String original) 

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 SHA512(String original) {
        String sha512 = "";
        try {//from   w w  w .ja  va  2 s  .c  o m
            final MessageDigest md = MessageDigest.getInstance("SHA-512");
            md.update(original.getBytes());
            final byte[] digest = md.digest();
            final StringBuilder sb = new StringBuilder();
            for (byte b : digest) {
                sb.append(String.format("%02x", b & 0xff));
            }
            sha512 = sb.toString();
        } catch (NoSuchAlgorithmException ignored) {
        }

        return sha512;
    }
}

Related

  1. sha512(String input)
  2. sha512(String string)
  3. sha512(String string)
  4. sha512AsBytes(byte[] input)
  5. sha512hash_base64(final String toHash)