MD5/Implementation Debug: Difference between revisions

m
no edit summary
m (Mistake regarding variable update order)
mNo edit summary
 
(One intermediate revision by one other user not shown)
Line 907:
{
for (int i = 0; i < 64; i++)
TABLE_T[i] = scaleToInt(int)(long)((1L << 32) * Math.abs(Math.sin(i + 1)));
}
private static int scaleToInt(double d)
{
// Converts IEEE-754 double from 0 to 1.0 to the range of an unsigned int
long n = Double.doubleToLongBits(d);
long exponent = (n >>> 52) & 0x7FF;
long fraction = (n & 0xFFFFFFFFFFFFFL) | 0x10000000000000L;
return (int)(fraction >>> (1043 - exponent));
}
Line 989 ⟶ 980:
b = temp;
int[] debugVars = new int[] { 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]));
if (((j + 1) & 3) == 0)
Line 1,080 ⟶ 1,071:
public static void main(String[] args)
{
String[] testStrings = new String[] { "", "a", "abc", "message digest", "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", "12345678901234567890123456789012345678901234567890123456789012345678901234567890" };
if (args.length > 0)
testStrings = args;
Anonymous user