1 /*
2 * GordianKnot: Security Suite
3 * Copyright 2012-2026. Tony Washer
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 * use this file except in compliance with the License. You may obtain a copy
7 * of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
17 package io.github.tonywasher.joceanus.gordianknot.api.base;
18
19 /**
20 * GordianKnot interface for Consumers such as Message Digests, Macs and Signatures.
21 */
22 public interface GordianConsumer {
23 /**
24 * Update the consumer with a portion of a byte array.
25 *
26 * @param pBytes the bytes to update with.
27 * @param pOffset the offset of the data within the byte array
28 * @param pLength the length of the data to use
29 */
30 void update(byte[] pBytes,
31 int pOffset,
32 int pLength);
33
34 /**
35 * Update the consumer with a single byte.
36 *
37 * @param pByte the byte to update with.
38 */
39 void update(byte pByte);
40
41 /**
42 * Update the consumer with a byte array.
43 *
44 * @param pBytes the bytes to update with.
45 */
46 default void update(final byte[] pBytes) {
47 update(pBytes, 0, pBytes == null ? 0 : pBytes.length);
48 }
49
50 /**
51 * Reset the Consumer.
52 */
53 void reset();
54 }