# Encrypting a short phrase into two keys. both with length of 32letters

It doesn't need to be crazy secure. I wanted to figure out if there's a popular practice when encrypting a short phrase (less than 32 letter long) into two keys (two strings 32 length). Doesn't need to be complicated. It's for a hobby project.

For example:

Key 1: JFHEL1J2J1KD1FK4J4K3LA5D7EKSJX323
Key 2: 1HFK6SJDHG2JEK3DHG5NRJG9HE5K3GJEH
Combined result: Hello World!

So in other words, if two keys get combined, it reveals a sentence. I suppose a simple mod/hash could work, but do you guys know of anything fancy?

-
What do you mean by "encrypting ... into two keys"? $\;$ –  Ricky Demer Apr 23 at 2:59
sorry! maybe I should've said encrypting into two seperate strings with length of 32 –  user590157 Apr 23 at 3:09
Sounds like you want to take a plaintext, and encrypt it into 2 different ciphertexts that need to be combined somehow to reveal the plaintext, correct? –  Richie Frame Apr 23 at 3:53
Yes. Correct!!! –  user590157 Apr 23 at 4:27
–  Ricky Demer Apr 23 at 5:27

As Ricky Demer mentioned, the Shamir Secret Sharing Scheme is information-theoretically secure ("crazy secure") and also, for the "trivial case" of "all shares are necessary to recover the secret", very simple.

We add all the shares together with "non-carrying addition", and the sum is decoded into the decrypted message. There are a huge variety of ways to "add" the shares, all of which are information-theoretically secure. The most popular seem to be

• non-carrying base 26 sum, aka Vigenère cipher variant Beaufort
• non-carrying base ten sum
• non-carrying base 2 sum, aka XOR, aka Vernam cipher

One example: Sum three shares using using Vigenere sum, with A:=0, B:=1, C:=2, D:=3, etc.:

ymunl buxee -- share 1 from Alice
htous qrgph -- share 2 from Bob
czdel fdoss -- share 3 from Trent
-----------
HELLO WORLD -- total


(If your phrase was less than 32 letters long, perhaps you could pad it out to 32 characters with Xs or Zs).

Another example: Sum three shares using non-carrying base sixteen, with A:=ten, B:=eleven, etc.: (using /dev/urandom and some other random number generator)

f 8 1 2  6 4 4 0  0 2 9 7  d 7 1 6  9 a e b  6 5 5 e -- share 1 from Alice
0 1 2 3  4 5 6 7  8 9 9 9  9 9 9 9  9 9 9 9  9 9 9 9 -- share 2 from Bob
5 f 3 0  c 3 c 5  e 4 0 0  f 7 c 0  5 f f 8  7 6 4 a -- share 3 from Trent
----------------------------------------------------
4 8 6 5  6 c 6 c  6 f 2 0  5 7 6 f  7 2 6 c  6 4 2 1 -- total

48  65   6c  6c   6f  20   57  6f   72  6c   64  21 (paired up)
H   e    l   l    o        W   o    r   l    d   ! (decoded using ASCII)


(If your phrase was less than 16 characters long, perhaps you could pad it out to 16 characters with 0x20 space characters or 0x00 null characters, giving 32 character shares).

EDIT: Oh, you're making physical objects, rather than sending text messages?

When making physical objects to encrypt some short phrase, I think that visual cryptography is a lot more fun.

The visual cryptography system described by Dirk Rijmenants can be done with ink on normal transparency paper, or holes drilled through metal, to do the XOR operation. (Is there a way to make the leftover "random background" less distracting ?).

The visual cryptography system used in the "amulets" of Henry Segerman uses linearly polarizing filters to to do the XOR operation.

Perhaps a tiny bitmap font would be useful. a b c d e f g h i k

-
Thanks for the awesome answer! I actually went a head and thought of XOR and created binaryrings.com I came back to see that there was an answer to my question. It's a relief that I was on a right track ;) Hopefully, I will be using this for my engagement ring –  user590157 May 3 at 11:28