I am working to take c code from an academic paper and edit. I am studying cryptographic algorithms. I have ran the following code, but I am having a little difficulty understanding two things. First, the program uses unsigned long ints. When they are added or subtracted, I don't get the values I would expect. For example:
P, Q, My sum by hand, sum using c
01100011010100011110000110110111
10111001011110010011011110011110
00011100110010110001100101010101
00011100110010110001100001010110
I understand that unsigned long int is 32 bit and that the addition is mod 2^32, but I thought the last carry bit when you add to the left by hand would be lost. Is it somehow added back on the right side?
Second, when I run the code, the output should include 5 examples in hex, but when I run it, the results have a lot of 0's mixed into the results. If you remove the 0's, the results are correct. Is this something I have done?
Thanks,
Chris