Search code examples
algorithmcryptographyredundancyinformation-theory

Efficient Three "Ships", One Message Algorithm


The premise is that person 1 wants to send a secret message M (without key sharing) across the ocean to person 2. She decides to send partial messages via 3 ships such than if any two ships' versions get delivered person 2 can construct the complete original message. The goal is to make each partial message (M1,M2,M3) undecipherable by itself. In the case that all 3 messages arrive the redundant message can be used as ECC/parity.

Assume the message is comprised of a series of 8-bit characters (m1,m2,m3...,mM). In the most efficient encoding len(M1+M2+M3) will be 1.5X len(M).

An inefficient coding is: M1 each character is comprised of the upper nibble (UN) plus the lower nibble (LN), M2 is comprised of UN minus LN, M3 is is simply LN. M1 and M2 use 5 bits per character, M3 uses 4 bits per character.

Note: the assignment could be rotated such that M1 gets UN+LN,UN-LN,LN,... M2 gets shifted UN-LN,LN,UN+LN,.. M3 gets double-shifted LN,UN+LN,UN-LN in order to:

1) Make the messages the same length (per 3 characters) 2) Add further obfuscation

This schema is effective but not efficient. Any suggested improvements or alternate methods?


Solution

  • Assume the message is comprised of a series of 8-bit characters (m1,m2,m3...,mM). In the most efficient encoding len(M1+M2+M3) will be 1.5X len(M).

    A scheme that meets this requirement is:

    • M1 : upper nibble (4 bits)
    • M2 : lower nibble (4 bits)
    • M3 : XOR of upper nibble and lower nibble (4 bits)

    i.e:

        bit of original 8 byte:
    M1: 7   6   5   4
    M2: 3   2   1   0
    M3: 7^3 6^2 5^1 4^0
    

    In the case of receiving M1 and M2, you have the message. In the case of receiving M1 and M3, M2 can be reconstructed by XORing M1 with M3. In the case of receving M2 and M3, M1 can be reconstructed by XORing M2 with M3. In each case the 3rd value can be used as a parity check.

    The code could be further obfuscated by shuffling the meaning of each bit in the nibble. For example bit 0 could use the above method, but for bit 1 (of the nibble) the lower nibble could be in M1, XOR value in M2 etc. i.e:

        bit of original 8 byte:
    M1: 7   6^2 1   4
    M2: 3   6   5^1 0
    M3: 7^3 2   5   4^0
    

    Note this is obfuscation, not security.