MD5/Implementation Debug: Difference between revisions

Content added Content deleted
m (Mistake regarding variable update order)
No edit summary
Line 989: Line 989:
b = temp;
b = temp;
int[] debugVars = new int[] { a, b, c, d };
int[] debugVars = { a, b, c, d };
System.out.println(" Applying [" + "BCDABCD".substring(3 - (j & 3), 7 - (j & 3)) + " " + padTwo(bufferIndex) + " " + padTwo(SHIFT_AMTS[(div16 << 2) | (j & 3)]) + " " + padTwo(j + 1) + "]: A=" + toHexString(debugVars[(j + 1) & 3]) + " B=" + toHexString(debugVars[(j + 2) & 3]) + " C=" + toHexString(debugVars[(j + 3) & 3]) + " D=" + toHexString(debugVars[j & 3]) + " T[" + j + "]=" + toHexString(TABLE_T[j]));
System.out.println(" Applying [" + "BCDABCD".substring(3 - (j & 3), 7 - (j & 3)) + " " + padTwo(bufferIndex) + " " + padTwo(SHIFT_AMTS[(div16 << 2) | (j & 3)]) + " " + padTwo(j + 1) + "]: A=" + toHexString(debugVars[(j + 1) & 3]) + " B=" + toHexString(debugVars[(j + 2) & 3]) + " C=" + toHexString(debugVars[(j + 3) & 3]) + " D=" + toHexString(debugVars[j & 3]) + " T[" + j + "]=" + toHexString(TABLE_T[j]));
if (((j + 1) & 3) == 0)
if (((j + 1) & 3) == 0)
Line 1,080: Line 1,080:
public static void main(String[] args)
public static void main(String[] args)
{
{
String[] testStrings = new String[] { "", "a", "abc", "message digest", "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", "12345678901234567890123456789012345678901234567890123456789012345678901234567890" };
String[] testStrings = { "", "a", "abc", "message digest", "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", "12345678901234567890123456789012345678901234567890123456789012345678901234567890" };
if (args.length > 0)
if (args.length > 0)
testStrings = args;
testStrings = args;