MCPcopy Index your code
hub / github.com/bcgit/bc-java / Blake3Mac

Class Blake3Mac

core/src/main/java/org/bouncycastle/crypto/macs/Blake3Mac.java:12–82  ·  view source on GitHub ↗

Bouncy implementation of Blake3Mac.

Source from the content-addressed store, hash-verified

10 * Bouncy implementation of Blake3Mac.
11 */
12public class Blake3Mac
13 implements Mac
14{
15 /**
16 * Digest.
17 */
18 private final Blake3Digest theDigest;
19
20 /**
21 * Create a blake3Mac with the specified digest.
22 *
23 * @param pDigest the base digest.
24 */
25 public Blake3Mac(final Blake3Digest pDigest)
26 {
27 /* Store the digest */
28 theDigest = pDigest;
29 }
30
31 public String getAlgorithmName()
32 {
33 return theDigest.getAlgorithmName() + "Mac";
34 }
35
36 public void init(final CipherParameters pParams)
37 {
38 CipherParameters myParams = pParams;
39 if (myParams instanceof KeyParameter)
40 {
41 myParams = Blake3Parameters.key(((KeyParameter)myParams).getKey());
42 }
43 if (!(myParams instanceof Blake3Parameters))
44 {
45 throw new IllegalArgumentException("Invalid parameter passed to Blake3Mac init - "
46 + pParams.getClass().getName());
47 }
48 final Blake3Parameters myBlakeParams = (Blake3Parameters)myParams;
49 if (myBlakeParams.getKey() == null)
50 {
51 throw new IllegalArgumentException("Blake3Mac requires a key parameter.");
52 }
53
54 /* Configure the digest */
55 theDigest.init(myBlakeParams);
56 }
57
58 public int getMacSize()
59 {
60 return theDigest.getDigestSize();
61 }
62
63 public void update(final byte in)
64 {
65 theDigest.update(in);
66 }
67
68 public void update(final byte[] in, final int inOff, final int len)
69 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected