Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Encryption Algorithm and bitwise parity

I am currently learning about encryption algorithms and working on problems. I am a little bit lost with this one here. I was wondering if anyone can give me some guidance. So far I know the initial parity definition is even parity but I am not sure how to proceed with the next steps. Thank you for any guidance.

"A simple hashing method divides the given data into integral number of bytes, padding with 1s to the lower order bits, if needed, to make the data integral multiple of bytes, and then computes bitwise parity of the bits in the bytes to come up with a byte-long hash code.

What would be the hash code computed by this scheme for the following data in hex: 0x000100010

List another data item of same length which will have the same hash code. Is this a good hashing scheme? Explain your answer.

Parity Definition: 10101011 1, odd number of 1s gives a parity value of 1. "

like image 993
Defcon Avatar asked Feb 18 '26 20:02

Defcon


1 Answers

Parity is pretty simple: it just means to count the number of 1 bits in the value to see if it's an even or odd number. In this case it looks like you're using even parity, which means that an odd number of 1s produces a parity value of 1 (so that the total number of 1 bits, including the parity, becomes even), and an even number of 1s produces a parity value of 0. Even parity is equivalent to just XORing all the bits together.

Your "bitwise parity" scheme sounds like you're supposed to take the value 0x000100010 (4.5 bytes) and expand it to 0x000100010F (5 bytes, with the low 4 bits being all 1), then split that into the 8-bit values 0x00, 0x01, 0x00, 0x01, and 0x0F, then bitwise-XOR all those together.

like image 137
Wyzard Avatar answered Feb 20 '26 20:02

Wyzard



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!