protected void doPadding(byte[] output, int outputOffset)
	{
		int ptr = flush();
		int bitLen = ptr << 3;
		long th = t1;
		long tl = t0 + bitLen;
		tmpBuf[ptr] = (byte)0x80;
		if (ptr == 0) {
			t0 = 0xFFFFFFFFFFFFFC00L;
			t1 = 0xFFFFFFFFFFFFFFFFL;
		} else if (t0 == 0) {
			t0 = (int)0xFFFFFFFFFFFFFC00L + bitLen;
			t1 --;
		} else {
			t0 -= 1024 - bitLen;
		}
		if (ptr < 112) {
			for (int i = ptr + 1; i < 112; i ++)
				tmpBuf[i] = 0x00;
			if (getDigestLength() == 64)
				tmpBuf[111] |= 0x01;
			encodeBELong(th, tmpBuf, 112);
			encodeBELong(tl, tmpBuf, 120);
			update(tmpBuf, ptr, 128 - ptr);
		} else {
			for (int i = ptr + 1; i < 128; i ++)
				tmpBuf[i] = 0;
			update(tmpBuf, ptr, 128 - ptr);
			t0 = 0xFFFFFFFFFFFFFC00L;
			t1 = 0xFFFFFFFFFFFFFFFFL;
			for (int i = 0; i < 112; i ++)
				tmpBuf[i] = 0x00;
			if (getDigestLength() == 64)
				tmpBuf[111] = 0x01;
			encodeBELong(th, tmpBuf, 112);
			encodeBELong(tl, tmpBuf, 120);
			update(tmpBuf, 0, 128);
		}
		encodeBELong(h0, output, outputOffset +  0);
		encodeBELong(h1, output, outputOffset +  8);
		encodeBELong(h2, output, outputOffset + 16);
		encodeBELong(h3, output, outputOffset + 24);
		encodeBELong(h4, output, outputOffset + 32);
		encodeBELong(h5, output, outputOffset + 40);
		if (getDigestLength() == 64) {
			encodeBELong(h6, output, outputOffset + 48);
			encodeBELong(h7, output, outputOffset + 56);
		}
	}