So, what you wrote wasn't exactly complete, at least I hope that it wasn't.
Code:
for (int i = 0; i < 16; i++) {
if ((digest & 0xFF) < 0x10) hexValue += "0";
hexValue += Integer.toHexString(digest & 0xFF);
What this does is print the byte representation of the variable digest 16 times. Essentially it does this:
Code:
for (int i = 0; i < 16; i++) {
hexValue += Integer.toHexString(digest & 0xFF);
but it prepends a '0' if the result of Integer.toHexString will be only 1 digit.
For example:
0x55 => "55"
0x04 => "04" (instead of just "4", which is what it would be without the if statement)
I would guess that digest is looping over the first 16 bytes of the file, or 16 random bytes in the file, whichever. Basically on each iteration of the loop it appends the 2 digit hex representation of digest to the end of the hexValue string.
Hope this helps.
Bookmarks