1.1 --- a/samples/messagedigest/test/api/CountingDigestor.java Sat Jun 14 10:32:31 2008 +0200
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,35 +0,0 @@
1.4 -/*
1.5 - * To change this template, choose Tools | Templates
1.6 - * and open the template in the editor.
1.7 - */
1.8 -
1.9 -package api;
1.10 -
1.11 -import java.nio.ByteBuffer;
1.12 -import spi.Digestor;
1.13 -
1.14 -/**
1.15 - *
1.16 - * @author jarda
1.17 - */
1.18 -public final class CountingDigestor extends Digestor<int[]> {
1.19 -
1.20 - @Override
1.21 - protected byte[] digest(int[] data) {
1.22 - int i = data[0];
1.23 - byte[] arr = { (byte) (i & 255), (byte) ((i >> 8) & 255), (byte) ((i >> 16) & 255), (byte) ((i >> 24) & 255) };
1.24 - return arr;
1.25 - }
1.26 -
1.27 - @Override
1.28 - protected int[] create(String algorithm) {
1.29 - return "cnt".equals(algorithm) ? new int[1] : null; // NOI18N
1.30 - }
1.31 -
1.32 - @Override
1.33 - protected void update(int[] data, ByteBuffer input) {
1.34 - data[0] += input.remaining();
1.35 - input.position(input.position() + input.remaining());
1.36 - }
1.37 -
1.38 -}