Java SHA512 sha512AsBytes(byte[] input)

Here you can find the source of sha512AsBytes(byte[] input)

Description

Generate SHA-512 as bytes.

License

Apache License

Parameter

Parameter Description
input Input as bytes.

Return

SHA bytes.

Declaration

public static byte[] sha512AsBytes(byte[] input) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

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

public class Main {
    /**/*  ww  w .ja  v a2 s  .  com*/
     * Generate SHA-512 as bytes.
     *
     * @param input Input as bytes.
     * @return SHA bytes.
     */
    public static byte[] sha512AsBytes(byte[] input) {
        MessageDigest md = null;
        try {
            md = MessageDigest.getInstance("SHA-512");
        } catch (NoSuchAlgorithmException e) {
            throw new RuntimeException(e);
        }
        md.update(input);
        return md.digest();
    }
}

Related

  1. sha512(String input)
  2. SHA512(String original)
  3. sha512(String string)
  4. sha512(String string)
  5. sha512hash_base64(final String toHash)
  6. sha512String(String base)