FileDocCategorySizeDatePackage
md.javaAPI DocExample13317Sat Nov 25 11:54:32 GMT 2000None

md4

public class md4 extends md

Fields Summary
Constructors Summary
md4(String s)

	super(s);
    
md4(byte[] in)

	super(in);
    
Methods Summary
static intF(int x, int y, int z)

	return((x & y) | (~x & z));
    
static intG(int x, int y, int z)

	return((x & y) | (x & z) | (y & z));
    
static intH(int x, int y, int z)

	return(x ^ y ^ z);
    
voidround1(int blk)

	A = rotintlft((A + F(B, C, D) + d[0 + 16 * blk]), 3);
	D = rotintlft((D + F(A, B, C) + d[1 + 16 * blk]), 7);
	C = rotintlft((C + F(D, A, B) + d[2 + 16 * blk]), 11);
	B = rotintlft((B + F(C, D, A) + d[3 + 16 * blk]), 19);

	A = rotintlft((A + F(B, C, D) + d[4 + 16 * blk]), 3);
	D = rotintlft((D + F(A, B, C) + d[5 + 16 * blk]), 7);
	C = rotintlft((C + F(D, A, B) + d[6 + 16 * blk]), 11);
	B = rotintlft((B + F(C, D, A) + d[7 + 16 * blk]), 19);

	A = rotintlft((A + F(B, C, D) + d[8 + 16 * blk]), 3);
	D = rotintlft((D + F(A, B, C) + d[9 + 16 * blk]), 7);
	C = rotintlft((C + F(D, A, B) + d[10 + 16 * blk]), 11);
	B = rotintlft((B + F(C, D, A) + d[11 + 16 * blk]), 19);

	A = rotintlft((A + F(B, C, D) + d[12 + 16 * blk]), 3);
	D = rotintlft((D + F(A, B, C) + d[13 + 16 * blk]), 7);
	C = rotintlft((C + F(D, A, B) + d[14 + 16 * blk]), 11);
	B = rotintlft((B + F(C, D, A) + d[15 + 16 * blk]), 19);
    
voidround2(int blk)

	A = rotintlft((A + G(B, C, D) + d[0 + 16 * blk] + 0x5a827999), 3);
	D = rotintlft((D + G(A, B, C) + d[4 + 16 * blk] + 0x5a827999), 5);
	C = rotintlft((C + G(D, A, B) + d[8 + 16 * blk] + 0x5a827999), 9);
	B = rotintlft((B + G(C, D, A) + d[12 + 16 * blk] + 0x5a827999), 13);

	A = rotintlft((A + G(B, C, D) + d[1 + 16 * blk] + 0x5a827999), 3);
	D = rotintlft((D + G(A, B, C) + d[5 + 16 * blk] + 0x5a827999), 5);
	C = rotintlft((C + G(D, A, B) + d[9 + 16 * blk] + 0x5a827999), 9);
	B = rotintlft((B + G(C, D, A) + d[13 + 16 * blk] + 0x5a827999), 13);

	A = rotintlft((A + G(B, C, D) + d[2 + 16 * blk] + 0x5a827999), 3);
	D = rotintlft((D + G(A, B, C) + d[6 + 16 * blk] + 0x5a827999), 5);
	C = rotintlft((C + G(D, A, B) + d[10 + 16 * blk] + 0x5a827999), 9);
	B = rotintlft((B + G(C, D, A) + d[14 + 16 * blk] + 0x5a827999), 13);

	A = rotintlft((A + G(B, C, D) + d[3 + 16 * blk] + 0x5a827999), 3);
	D = rotintlft((D + G(A, B, C) + d[7 + 16 * blk] + 0x5a827999), 5);
	C = rotintlft((C + G(D, A, B) + d[11 + 16 * blk] + 0x5a827999), 9);
	B = rotintlft((B + G(C, D, A) + d[15 + 16 * blk] + 0x5a827999), 13);

    
voidround3(int blk)

	A = rotintlft((A + H(B, C, D) + d[0 + 16 * blk] + 0x6ed9eba1), 3);
	D = rotintlft((D + H(A, B, C) + d[8 + 16 * blk] + 0x6ed9eba1), 9);
	C = rotintlft((C + H(D, A, B) + d[4 + 16 * blk] + 0x6ed9eba1), 11);
	B = rotintlft((B + H(C, D, A) + d[12 + 16 * blk] + 0x6ed9eba1), 15);

	A = rotintlft((A + H(B, C, D) + d[2 + 16 * blk] + 0x6ed9eba1), 3);
	D = rotintlft((D + H(A, B, C) + d[10 + 16 * blk] + 0x6ed9eba1), 9);
	C = rotintlft((C + H(D, A, B) + d[6 + 16 * blk] + 0x6ed9eba1), 11);
	B = rotintlft((B + H(C, D, A) + d[14 + 16 * blk] + 0x6ed9eba1), 15);

	A = rotintlft((A + H(B, C, D) + d[1 + 16 * blk] + 0x6ed9eba1), 3);
	D = rotintlft((D + H(A, B, C) + d[9 + 16 * blk] + 0x6ed9eba1), 9);
	C = rotintlft((C + H(D, A, B) + d[5 + 16 * blk] + 0x6ed9eba1), 11);
	B = rotintlft((B + H(C, D, A) + d[13 + 16 * blk] + 0x6ed9eba1), 15);

	A = rotintlft((A + H(B, C, D) + d[3 + 16 * blk] + 0x6ed9eba1), 3);
	D = rotintlft((D + H(A, B, C) + d[11 + 16 * blk] + 0x6ed9eba1), 9);
	C = rotintlft((C + H(D, A, B) + d[7 + 16 * blk] + 0x6ed9eba1), 11);
	B = rotintlft((B + H(C, D, A) + d[15 + 16 * blk] + 0x6ed9eba1), 15);

    
voidround4(int blk)

	System.out.println(" must be md5, in round4!");