Example usage for java.security.spec MGF1ParameterSpec SHA1

List of usage examples for java.security.spec MGF1ParameterSpec SHA1

Introduction

In this page you can find the example usage for java.security.spec MGF1ParameterSpec SHA1.

Prototype

MGF1ParameterSpec SHA1

To view the source code for java.security.spec MGF1ParameterSpec SHA1.

Click Source Link

Document

The MGF1ParameterSpec which uses "SHA-1" message digest

Usage

From source file:com.fabernovel.alertevoirie.webservice.HttpPostRequest.java

private static String sha1(String raw) throws UnsupportedEncodingException, NoSuchAlgorithmException {
    byte[] bytes = raw.getBytes("UTF-8");
    MessageDigest md = MessageDigest.getInstance(MGF1ParameterSpec.SHA1.getDigestAlgorithm());
    md.update(bytes);/*from   w ww .  j  a va  2 s  .c o  m*/
    byte[] digest = md.digest();

    return toHex(digest);
}