1 /**
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one or more
4 * contributor license agreements. See the NOTICE file distributed with
5 * this work for additional information regarding copyright ownership.
6 * The ASF licenses this file to You under the Apache License, Version 2.0
7 * (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19 package org.apache.geronimo.util.crypto;
20
21 /**
22 * interface that a message digest conforms to.
23 */
24 public interface Digest
25 {
26 /**
27 * return the algorithm name
28 *
29 * @return the algorithm name
30 */
31 public String getAlgorithmName();
32
33 /**
34 * return the size, in bytes, of the digest produced by this message digest.
35 *
36 * @return the size, in bytes, of the digest produced by this message digest.
37 */
38 public int getDigestSize();
39
40 /**
41 * update the message digest with a single byte.
42 *
43 * @param in the input byte to be entered.
44 */
45 public void update(byte in);
46
47 /**
48 * update the message digest with a block of bytes.
49 *
50 * @param in the byte array containing the data.
51 * @param inOff the offset into the byte array where the data starts.
52 * @param len the length of the data.
53 */
54 public void update(byte[] in, int inOff, int len);
55
56 /**
57 * close the digest, producing the final digest value. The doFinal
58 * call leaves the digest reset.
59 *
60 * @param out the array the digest is to be copied into.
61 * @param outOff the offset into the out array the digest is to start at.
62 */
63 public int doFinal(byte[] out, int outOff);
64
65 /**
66 * reset the digest back to it's initial state.
67 */
68 public void reset();
69 }