Java Digest digest(byte[] bytes)

Here you can find the source of digest(byte[] bytes)

Description

digest

License

LGPL

Declaration

public static String digest(byte[] bytes) throws NoSuchAlgorithmException 

Method Source Code


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

import sun.misc.BASE64Encoder;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class Main {
    public static String digest(byte[] bytes) throws NoSuchAlgorithmException {
        MessageDigest sha = MessageDigest.getInstance("SHA");
        byte[] digest = sha.digest(bytes);
        BASE64Encoder base64Encoder = new BASE64Encoder();
        return base64Encoder.encode(digest);
    }/*from w  ww .j a v  a 2 s .c o  m*/
}

Related

  1. digest(byte[] buffer)
  2. digest(byte[] bytes, String algorithm)
  3. digest(byte[] bytes, String algorithmName)
  4. digest(byte[] bytes, String txt)
  5. digest(byte[] data)