/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* The MD4 class is used to compute an MD4 message digest over a given
* buffer of bytes. It is an implementation of the RSA Data Security Inc
* MD4 algorithim as described in internet RFC 1320.
*
* <p>The MD4 algorithm is very weak and should not be used unless it is
* unavoidable. Therefore, it is not registered in our standard providers. To
* obtain an implementation, call the static getInstance() method in this
* class.
*
* @author Andreas Sterbenz
*/
// state of this object
private final int[] state;
// temporary buffer, used by implCompress()
private final int[] x;
// rotation constants
static {
return null;
}
});
}
try {
} catch (NoSuchAlgorithmException e) {
// should never occur
throw new ProviderException(e);
}
}
// Standard constructor, creates a new MD4 instance.
public MD4() {
super("MD4", 16, 64);
state = new int[4];
x = new int[16];
implReset();
}
// Cloning constructor
super(base);
this.x = new int[16];
}
// clone this object
return new MD4(this);
}
/**
* Reset the state of this object.
*/
void implReset() {
// Load magic initialization constants.
}
/**
* Perform the final computations, any buffered bytes are added
* to the digest, the count is added to the digest, and the resulting
* digest is stored.
*/
}
private static int FF(int a, int b, int c, int d, int x, int s) {
a += ((b & c) | ((~b) & d)) + x;
return ((a << s) | (a >>> (32 - s)));
}
private static int GG(int a, int b, int c, int d, int x, int s) {
a += ((b & c) | (b & d) | (c & d)) + x + 0x5a827999;
return ((a << s) | (a >>> (32 - s)));
}
private static int HH(int a, int b, int c, int d, int x, int s) {
a += ((b ^ c) ^ d) + x + 0x6ed9eba1;
return ((a << s) | (a >>> (32 - s)));
}
/**
* This is where the functions come together as the generic MD4
* transformation operation. It consumes sixteen
* bytes from the buffer, beginning at the specified offset.
*/
int a = state[0];
int b = state[1];
int c = state[2];
int d = state[3];
/* Round 1 */
/* Round 2 */
/* Round 3 */
state[0] += a;
state[1] += b;
state[2] += c;
state[3] += d;
}
}