I have a 128 bit encryption key that I would like to break up into three parts that when XOR’ed together reproduce the key.
How do I do this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Pick two other 128 bit values at random (random_1 and random_2), then work out the equations to see how it works:
key ^ random_1 = xor_1Now split xor_1 the same way:
xor_1 ^ random_2 = xor_2Flipping that equation around, we get:
xor_1 = xor_2 ^ random_2Now substitute back into the first equation:
key = random_1 ^ xor_2 ^ random_2So your code will just do
xor = key ^ random_1 ^ random_2and you distribute everything but the key.