Java SHA1 sha1Sum(byte[] ba)

Here you can find the source of sha1Sum(byte[] ba)

Description

This method is used to calculate key identifiers.

License

Open Source License

Declaration

private static byte[] sha1Sum(byte[] ba) 

Method Source Code

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

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

public class Main {
    /**/*from  ww w .j a  v  a 2  s. c  o m*/
     * This method is used to calculate key identifiers. 
     * Both RFC 3280 and RFC 5280 provide examples on
     * key identifier generation.
     */
    private static byte[] sha1Sum(byte[] ba) {
        byte[] digest = null;
        MessageDigest md = null;
        try {
            md = MessageDigest.getInstance("SHA-1");
            md.update(ba);
            digest = md.digest();
        } catch (NoSuchAlgorithmException e) {
            /*
             * Swallowing because all JCE providers require
             * SHA-1 support
             */
        }
        return digest;
    }
}

Related

  1. sha1HashInt(String text)
  2. sha1Hex(byte[] bytes)
  3. sha1Hex(String data)
  4. sha1hex(String source)
  5. sha1Java(String password)
  6. sha1sum(byte[] data, Integer startIdxInc, Integer stopIdxExc)
  7. sha1sum(byte[] input, int length)
  8. sha1sum(File file)
  9. sha1sum(File file)