Java Code Examples for org.spongycastle.crypto.macs.HMac#init()
The following examples show how to use
org.spongycastle.crypto.macs.HMac#init() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Cryptograph.java From SightRemote with GNU General Public License v3.0 | 5 votes |
private static byte[] getHmac(byte[] secret, byte[] data, Digest algorithm) { HMac hmac = new HMac(algorithm); hmac.init(new KeyParameter(secret)); byte[] result = new byte[hmac.getMacSize()]; hmac.update(data, 0, data.length); hmac.doFinal(result, 0); return result; }
Example 2
Source File: CryptoPrimitivesAndroid.java From Clusion with GNU General Public License v3.0 | 5 votes |
public static byte[] generateHmac(byte[] key, String msg) throws UnsupportedEncodingException { HMac hmac = new HMac(new SHA256Digest()); byte[] result = new byte[hmac.getMacSize()]; byte[] msgAry = msg.getBytes("UTF-8"); hmac.init(new KeyParameter(key)); hmac.reset(); hmac.update(msgAry, 0, msgAry.length); hmac.doFinal(result, 0); return result; }
Example 3
Source File: CryptoPrimitivesAndroid.java From Clusion with GNU General Public License v3.0 | 5 votes |
public static byte[] generateHmac(byte[] key, byte[] msg) throws UnsupportedEncodingException { HMac hmac = new HMac(new SHA256Digest()); byte[] result = new byte[hmac.getMacSize()]; hmac.init(new KeyParameter(key)); hmac.reset(); hmac.update(msg, 0, msg.length); hmac.doFinal(result, 0); return result; }
Example 4
Source File: CryptoPrimitivesAndroid.java From Clusion with GNU General Public License v3.0 | 5 votes |
public static byte[] generateHmac512(byte[] key, String msg) throws UnsupportedEncodingException { HMac hmac = new HMac(new SHA512Digest()); byte[] result = new byte[hmac.getMacSize()]; byte[] msgAry = msg.getBytes("UTF-8"); hmac.init(new KeyParameter(key)); hmac.reset(); hmac.update(msgAry, 0, msgAry.length); hmac.doFinal(result, 0); return result; }
Example 5
Source File: Cryptograph.java From AndroidAPS with GNU Affero General Public License v3.0 | 5 votes |
private static byte[] getHmac(byte[] secret, byte[] data, Digest algorithm) { HMac hmac = new HMac(algorithm); hmac.init(new KeyParameter(secret)); byte[] result = new byte[hmac.getMacSize()]; hmac.update(data, 0, data.length); hmac.doFinal(result, 0); return result; }
Example 6
Source File: HDUtils.java From bcm-android with GNU General Public License v3.0 | 4 votes |
static HMac createHmacSha512Digest(byte[] key) { SHA512Digest digest = new SHA512Digest(); HMac hMac = new HMac(digest); hMac.init(new KeyParameter(key)); return hMac; }
Example 7
Source File: HDUtils.java From green_android with GNU General Public License v3.0 | 4 votes |
static HMac createHmacSha512Digest(byte[] key) { SHA512Digest digest = new SHA512Digest(); HMac hMac = new HMac(digest); hMac.init(new KeyParameter(key)); return hMac; }
Example 8
Source File: HDUtils.java From GreenBits with GNU General Public License v3.0 | 4 votes |
static HMac createHmacSha512Digest(byte[] key) { SHA512Digest digest = new SHA512Digest(); HMac hMac = new HMac(digest); hMac.init(new KeyParameter(key)); return hMac; }
Example 9
Source File: HDUtils.java From bitherj with Apache License 2.0 | 4 votes |
static HMac createHmacSha512Digest(byte[] key) { SHA512Digest digest = new SHA512Digest(); HMac hMac = new HMac(digest); hMac.init(new KeyParameter(key)); return hMac; }