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