1b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallampackage org.bouncycastle.crypto;
2b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam
3b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam/**
4b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam * interface that a message digest conforms to.
5b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam */
6b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallampublic interface Digest
7b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam{
8b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam    /**
9b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam     * return the algorithm name
10b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam     *
11b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam     * @return the algorithm name
12b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam     */
13b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam    public String getAlgorithmName();
14b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam
15b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam    /**
16b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam     * return the size, in bytes, of the digest produced by this message digest.
17b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam     *
18b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam     * @return the size, in bytes, of the digest produced by this message digest.
19b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam     */
20b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam    public int getDigestSize();
21b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam
22b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam    /**
23b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam     * update the message digest with a single byte.
24b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam     *
25b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam     * @param in the input byte to be entered.
26b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam     */
27b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam    public void update(byte in);
28b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam
29b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam    /**
30b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam     * update the message digest with a block of bytes.
31b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam     *
32b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam     * @param in the byte array containing the data.
33b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam     * @param inOff the offset into the byte array where the data starts.
34b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam     * @param len the length of the data.
35b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam     */
36b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam    public void update(byte[] in, int inOff, int len);
37b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam
38b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam    /**
39b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam     * close the digest, producing the final digest value. The doFinal
40b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam     * call leaves the digest reset.
41b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam     *
42b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam     * @param out the array the digest is to be copied into.
43b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam     * @param outOff the offset into the out array the digest is to start at.
44b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam     */
45b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam    public int doFinal(byte[] out, int outOff);
46b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam
47b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam    /**
48b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam     * reset the digest back to it's initial state.
49b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam     */
50b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam    public void reset();
51b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam}
52