001 /**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017
018 package org.apache.geronimo.util.crypto;
019
020 /**
021 * interface that a message digest conforms to.
022 */
023 public interface Digest
024 {
025 /**
026 * return the algorithm name
027 *
028 * @return the algorithm name
029 */
030 public String getAlgorithmName();
031
032 /**
033 * return the size, in bytes, of the digest produced by this message digest.
034 *
035 * @return the size, in bytes, of the digest produced by this message digest.
036 */
037 public int getDigestSize();
038
039 /**
040 * update the message digest with a single byte.
041 *
042 * @param in the input byte to be entered.
043 */
044 public void update(byte in);
045
046 /**
047 * update the message digest with a block of bytes.
048 *
049 * @param in the byte array containing the data.
050 * @param inOff the offset into the byte array where the data starts.
051 * @param len the length of the data.
052 */
053 public void update(byte[] in, int inOff, int len);
054
055 /**
056 * close the digest, producing the final digest value. The doFinal
057 * call leaves the digest reset.
058 *
059 * @param out the array the digest is to be copied into.
060 * @param outOff the offset into the out array the digest is to start at.
061 */
062 public int doFinal(byte[] out, int outOff);
063
064 /**
065 * reset the digest back to it's initial state.
066 */
067 public void reset();
068 }