src/main/java/org/wymiwyg/commons/util/MD5.java
public void md5final(byte[] digest) {
		/* "final" is a poor method name in Java. :v) */
		int count;
		int p;		// in original code, this is a pointer; in this java code
					// it's an index into the array this->in.

	    /* Compute number of bytes mod 64 */
	    count = (int) ((bits >>> 3) & 0x3F);
	
	    /* Set the first char of padding to 0x80.  This is safe since there is
	       always at least one byte free */
		p = count;
		in[p++] = (byte) 0x80;
	
	    /* Bytes of padding needed to make 64 bytes */
	    count = 64 - 1 - count;
	
	    /* Pad out to 56 mod 64 */
	    if (count < 8) {
			/* Two lots of padding:  Pad the first block to 64 bytes */
			zeroByteArray(in, p, count);
			transform();
		
			/* Now fill the next block with 56 bytes */
			zeroByteArray(in, 0, 56);
	    } else {
			/* Pad block to 56 bytes */
			zeroByteArray(in, p, count - 8);
	    }
	
	    /* Append length in bits and transform */
		// Could use a PUT_64BIT... func here. This is a fairly
		// direct translation from the C code, where bits was an array
		// of two 32-bit ints.
		int lowbits =	(int) bits;
		int highbits =	(int) (bits >>> 32);
	    PUT_32BIT_LSB_FIRST(in, 56, lowbits);
	    PUT_32BIT_LSB_FIRST(in, 60, highbits);
	
		transform();
	    PUT_32BIT_LSB_FIRST(digest,  0, buf[0]);
	    PUT_32BIT_LSB_FIRST(digest,  4, buf[1]);
	    PUT_32BIT_LSB_FIRST(digest,  8, buf[2]);
	    PUT_32BIT_LSB_FIRST(digest, 12, buf[3]);

		/* zero sensitive data */
		/* notice this misses any sneaking out on the stack. The C
		 * version uses registers in some spots, perhaps because
		 * they care about this.
		 */
		zeroByteArray(in);
		zeroIntArray(buf);
		bits = 0;
		zeroIntArray(inint);
	}
public void md5final(byte[] digest) {
		/* "final" is a poor method name in Java. :v) */
		int count;
		int p;		// in original code, this is a pointer; in this java code
					// it's an index into the array this->in.

	    /* Compute number of bytes mod 64 */
	    count = (int) ((bits >>> 3) & 0x3F);
	
	    /* Set the first char of padding to 0x80.  This is safe since there is
	       always at least one byte free */
		p = count;
		in[p++] = (byte) 0x80;
	
	    /* Bytes of padding needed to make 64 bytes */
	    count = 64 - 1 - count;
	
	    /* Pad out to 56 mod 64 */
	    if (count < 8) {
			/* Two lots of padding:  Pad the first block to 64 bytes */
			zeroByteArray(in, p, count);
			transform();
		
			/* Now fill the next block with 56 bytes */
			zeroByteArray(in, 0, 56);
	    } else {
			/* Pad block to 56 bytes */
			zeroByteArray(in, p, count - 8);
	    }
	
	    /* Append length in bits and transform */
		// Could use a PUT_64BIT... func here. This is a fairly
		// direct translation from the C code, where bits was an array
		// of two 32-bit ints.
		int lowbits =	(int) bits;
		int highbits =	(int) (bits >>> 32);
	    PUT_32BIT_LSB_FIRST(in, 56, lowbits);
	    PUT_32BIT_LSB_FIRST(in, 60, highbits);
	
		transform();
	    PUT_32BIT_LSB_FIRST(digest,  0, buf[0]);
	    PUT_32BIT_LSB_FIRST(digest,  4, buf[1]);
	    PUT_32BIT_LSB_FIRST(digest,  8, buf[2]);
	    PUT_32BIT_LSB_FIRST(digest, 12, buf[3]);

		/* zero sensitive data */
		/* notice this misses any sneaking out on the stack. The C
		 * version uses registers in some spots, perhaps because
		 * they care about this.
		 */
		zeroByteArray(in);
		zeroIntArray(buf);
		bits = 0;
		zeroIntArray(inint);
	}
/*
Final wrapup - pad to 64-byte boundary with the bit pattern
1 0* (64-bit count of bits processed, MSB-first)