Android SHA1 Hash Create hmacSha1(byte[] value, byte[] key)

Here you can find the source of hmacSha1(byte[] value, byte[] key)

Description

hmac Sha

License

LGPL

Declaration

private static byte[] hmacSha1(byte[] value, byte[] key) 

Method Source Code

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

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;

public class Main {
    private static byte[] hmacSha1(byte[] value, byte[] key) {
        try {//from w  w w . j  av a  2 s . c  om
            SecretKeySpec signingKey = new SecretKeySpec(key, "HmacSHA1");
            Mac mac = Mac.getInstance("HmacSHA1");
            mac.init(signingKey);
            return mac.doFinal(value);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}

Related

  1. shaByte(String in)
  2. shaByte(byte[] in)
  3. calculateSHA1(byte[] data)
  4. sha1(byte[] bytesOfMessage)
  5. getCertificateSHA1(X509Certificate certificate)
  6. computeSHAHash(String password)
  7. encryptByUsingSha1(String passwd)
  8. generateDigest(byte[] inputBytes)