Java SHA1 SHA1(byte[] bytes)

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

Description

SHA

License

Open Source License

Declaration

public static byte[] SHA1(byte[] bytes) 

Method Source Code


//package com.java2s;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class Main {

    public static byte[] SHA1(byte[] bytes) {
        return digest("SHA-1", bytes);
    }/*w  ww  .  j  a va 2s.  co m*/

    private static byte[] digest(String type, byte[] bytes) {
        try {
            MessageDigest dist = MessageDigest.getInstance(type);
            return dist.digest(bytes);
        } catch (NoSuchAlgorithmException e) {
            throw new IllegalArgumentException("Cannot find digest:" + type, e);
        }
    }
}

Related

  1. generateSHA1RSASignature(RSAPrivateKey privKey, byte[] text)
  2. generateSHA1String(String stringToEncode)
  3. sha1(byte[] bytes)
  4. sha1(byte[] bytes)
  5. sha1(byte[] bytes)
  6. SHA1(byte[] convertme)
  7. sha1(byte[] data)
  8. sha1(byte[] data)
  9. sha1(byte[] data)