Two tiny Python scripts to split a string into two hex-encoded shares using XOR, and to recombine those shares back into the original string.
Useful for sharing a secret across two people (both shares required) or sending it over two separate channels so compromising one channel alone doesn’t reveal the secret.
- Python 3
split.py takes a plaintext string and prints two lines:
- a random pad (hex)
- the XOR of the plaintext bytes with that pad (hex)
$ ./split.py "hello world"
c930646d6c7039391a3ea2
a155080103504e566852c6combine.py takes the two hex strings (pad and xor output) and prints the recovered plaintext.
$ ./combine.py c930646d6c7039391a3ea2 a155080103504e566852c6
hello world