1 // Tags: not-a-test |
|
2 |
|
3 // Copyright (C) 2002 Free Software Foundation, Inc. |
|
4 // Written by Mark Wielaard (mark@klomp.org) |
|
5 |
|
6 // This file is part of Mauve. |
|
7 |
|
8 // Mauve is free software; you can redistribute it and/or modify |
|
9 // it under the terms of the GNU General Public License as published by |
|
10 // the Free Software Foundation; either version 2, or (at your option) |
|
11 // any later version. |
|
12 |
|
13 // Mauve is distributed in the hope that it will be useful, |
|
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 // GNU General Public License for more details. |
|
17 |
|
18 // You should have received a copy of the GNU General Public License |
|
19 // along with Mauve; see the file COPYING. If not, write to |
|
20 // the Free Software Foundation, 59 Temple Place - Suite 330, |
|
21 // Boston, MA 02111-1307, USA. */ |
|
22 |
|
23 package gnu.testlet.java.security.MessageDigest; |
|
24 |
|
25 import java.security.MessageDigestSpi; |
|
26 |
|
27 // Dummy digest that just contains what was put in. |
|
28 public class MauveDigest extends MessageDigestSpi |
|
29 { |
|
30 private byte[] digest; |
|
31 |
|
32 public void engineUpdate(byte b) |
|
33 { |
|
34 digest = new byte[1]; |
|
35 digest[0] = b; |
|
36 } |
|
37 |
|
38 public void engineUpdate(byte[] bs, int off, int len) |
|
39 { |
|
40 digest = new byte[len]; |
|
41 System.arraycopy(bs, off, digest, 0, len); |
|
42 } |
|
43 |
|
44 public byte[] engineDigest() |
|
45 { |
|
46 return digest; |
|
47 } |
|
48 |
|
49 public void engineReset() |
|
50 { |
|
51 digest = new byte[0]; |
|
52 } |
|
53 } |
|
54 |
|