Base class for SHA-384 and SHA-512.
| 10 | * Base class for SHA-384 and SHA-512. |
| 11 | */ |
| 12 | public abstract class LongDigest |
| 13 | implements ExtendedDigest, Memoable, EncodableDigest |
| 14 | { |
| 15 | private static final int BYTE_LENGTH = 128; |
| 16 | |
| 17 | protected final CryptoServicePurpose purpose; |
| 18 | |
| 19 | private byte[] xBuf = new byte[8]; |
| 20 | private int xBufOff; |
| 21 | |
| 22 | private long byteCount1; |
| 23 | private long byteCount2; |
| 24 | |
| 25 | protected long H1, H2, H3, H4, H5, H6, H7, H8; |
| 26 | |
| 27 | private long[] W = new long[80]; |
| 28 | private int wOff; |
| 29 | |
| 30 | /** |
| 31 | * Constructor for variable length word |
| 32 | */ |
| 33 | protected LongDigest() |
| 34 | { |
| 35 | this(CryptoServicePurpose.ANY); |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * Constructor for variable length word |
| 40 | */ |
| 41 | protected LongDigest(CryptoServicePurpose purpose) |
| 42 | { |
| 43 | this.purpose = purpose; |
| 44 | |
| 45 | xBufOff = 0; |
| 46 | |
| 47 | reset(); |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * Copy constructor. We are using copy constructors in place |
| 52 | * of the Object.clone() interface as this interface is not |
| 53 | * supported by J2ME. |
| 54 | */ |
| 55 | protected LongDigest(LongDigest t) |
| 56 | { |
| 57 | this.purpose = t.purpose; |
| 58 | |
| 59 | copyIn(t); |
| 60 | } |
| 61 | |
| 62 | protected void copyIn(LongDigest t) |
| 63 | { |
| 64 | System.arraycopy(t.xBuf, 0, xBuf, 0, t.xBuf.length); |
| 65 | |
| 66 | xBufOff = t.xBufOff; |
| 67 | byteCount1 = t.byteCount1; |
| 68 | byteCount2 = t.byteCount2; |
| 69 |
nothing calls this directly
no outgoing calls
no test coverage detected