From ac1ed908de999523efc36f38e69bca1aadfe0808 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 14 Aug 2006 23:12:35 +0000 Subject: Imported GNU Classpath 0.92 2006-08-14 Mark Wielaard Imported GNU Classpath 0.92 * HACKING: Add more importing hints. Update automake version requirement. * configure.ac (gconf-peer): New enable AC argument. Add --disable-gconf-peer and --enable-default-preferences-peer to classpath configure when gconf is disabled. * scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and gnu/java/awt/dnd/peer/gtk to bc. Classify gnu/java/security/Configuration.java as generated source file. * gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java, gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java, gnu/java/lang/management/VMClassLoadingMXBeanImpl.java, gnu/java/lang/management/VMRuntimeMXBeanImpl.java, gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java, gnu/java/lang/management/VMThreadMXBeanImpl.java, gnu/java/lang/management/VMMemoryMXBeanImpl.java, gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub classes. * java/lang/management/VMManagementFactory.java: Likewise. * java/net/VMURLConnection.java: Likewise. * gnu/java/nio/VMChannel.java: Likewise. * java/lang/Thread.java (getState): Add stub implementation. * java/lang/Class.java (isEnum): Likewise. * java/lang/Class.h (isEnum): Likewise. * gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed. * javax/naming/spi/NamingManager.java: New override for StackWalker functionality. * configure, sources.am, Makefile.in, gcj/Makefile.in, include/Makefile.in, testsuite/Makefile.in: Regenerated. From-SVN: r116139 --- .../classpath/gnu/java/security/hash/BaseHash.java | 61 +++++++--------------- 1 file changed, 19 insertions(+), 42 deletions(-) (limited to 'libjava/classpath/gnu/java/security/hash/BaseHash.java') diff --git a/libjava/classpath/gnu/java/security/hash/BaseHash.java b/libjava/classpath/gnu/java/security/hash/BaseHash.java index 720b835392a..ff1750aeae0 100644 --- a/libjava/classpath/gnu/java/security/hash/BaseHash.java +++ b/libjava/classpath/gnu/java/security/hash/BaseHash.java @@ -39,14 +39,11 @@ exception statement from your version. */ package gnu.java.security.hash; /** - *

A base abstract class to facilitate hash implementations.

+ * A base abstract class to facilitate hash implementations. */ -public abstract class BaseHash implements IMessageDigest +public abstract class BaseHash + implements IMessageDigest { - - // Constants and variables - // ------------------------------------------------------------------------- - /** The canonical name prefix of the hash. */ protected String name; @@ -62,12 +59,9 @@ public abstract class BaseHash implements IMessageDigest /** Temporary input buffer. */ protected byte[] buffer; - // Constructor(s) - // ------------------------------------------------------------------------- - /** - *

Trivial constructor for use by concrete subclasses.

- * + * Trivial constructor for use by concrete subclasses. + * * @param name the canonical name prefix of this instance. * @param hashSize the block size of the output in bytes. * @param blockSize the block size of the internal transform. @@ -84,14 +78,6 @@ public abstract class BaseHash implements IMessageDigest resetContext(); } - // Class methods - // ------------------------------------------------------------------------- - - // Instance methods - // ------------------------------------------------------------------------- - - // IMessageDigest interface implementation --------------------------------- - public String name() { return name; @@ -114,9 +100,7 @@ public abstract class BaseHash implements IMessageDigest count++; buffer[i] = b; if (i == (blockSize - 1)) - { - transform(buffer, 0); - } + transform(buffer, 0); } public void update(byte[] b) @@ -136,16 +120,13 @@ public abstract class BaseHash implements IMessageDigest System.arraycopy(b, offset, buffer, n, partLen); transform(buffer, 0); for (i = partLen; i + blockSize - 1 < len; i += blockSize) - { - transform(b, offset + i); - } + transform(b, offset + i); + n = 0; } if (i < len) - { - System.arraycopy(b, offset + i, buffer, n, len - i); - } + System.arraycopy(b, offset + i, buffer, n, len - i); } public byte[] digest() @@ -163,31 +144,27 @@ public abstract class BaseHash implements IMessageDigest { // reset this instance for future re-use count = 0L; for (int i = 0; i < blockSize;) - { - buffer[i++] = 0; - } + buffer[i++] = 0; resetContext(); } - // methods to be implemented by concrete subclasses ------------------------ - public abstract Object clone(); public abstract boolean selfTest(); /** - *

Returns the byte array to use as padding before completing a hash - * operation.

- * + * Returns the byte array to use as padding before completing a hash + * operation. + * * @return the bytes to pad the remaining bytes in the buffer before - * completing a hash operation. + * completing a hash operation. */ protected abstract byte[] padBuffer(); /** - *

Constructs the result from the contents of the current context.

- * + * Constructs the result from the contents of the current context. + * * @return the output of the completed hash operation. */ protected abstract byte[] getResult(); @@ -196,11 +173,11 @@ public abstract class BaseHash implements IMessageDigest protected abstract void resetContext(); /** - *

The block digest transformation per se.

- * + * The block digest transformation per se. + * * @param in the blockSize long block, as an array of bytes to digest. * @param offset the index where the data to digest is located within the - * input buffer. + * input buffer. */ protected abstract void transform(byte[] in, int offset); } -- cgit v1.2.3