Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Checksum Shift operator

807599Apr 11 2007 — edited Apr 11 2007
I am trying to write this pseudocode

checksum = 0

for each character, C, in the word {
rotate the (16 bit) checksum 1 bit to the right
XOR the character into the most significant byte of the checksum
}

The code that I have written so far, which isnt really working is;
int csum=0;
for(int i=0;i<c.length;i++)
{
     csum = csum>>1;
     csum=c[i]^(csum>>8);
}
c is an int array holding the word I want to generate the checksum from.

Can anyone see what is wrong? TIA
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 9 2007
Added on Apr 11 2007
24 comments
492 views