Is there a tool that will allow me to encrypt n plaintexts with n corresponding keys such that:

  • the cipher text is one file with no clue as to the value of n.
  • decrypting with key i (1<=i<=n) produces plaintext i.
  • n > 1

Edit: an example of a scheme that meets the second and third criteria but not the first would be a tar file containing n separate GPG-encrypted files.

Edit 2: an example of a scheme that meets all three criteria would be TrueCrypt hidden volumes, but I am looking for something that works with individual files rather than a disk encryption system (plus this doesn't really meet the first criterion as the value of n is always 2)

  • It's not clear what you're asking. n keys encrypting n plaintexts would produce n ciphertexts, or at least one ciphertext that's n times as large as the original. Commented Jan 14, 2016 at 21:10
  • Yes I imagined it would have to be a ciphertext which is about the same size as the sum of all the plaintexts.
    – jl6
    Commented Jan 14, 2016 at 21:14
  • If you really require that you have n separate ciphertexts, and distribute all of them at once, the size of the file is going to reveal n. Unless you have a massive amount of padding that keeps the size of the cryptotext a constant (and reduce the padding to keep it constant regardless of n), then I see no way to prevent the size of the cryptotext from revealing n. Commented Jan 14, 2016 at 21:29
  • Abstract problems like this are notoriously difficult to solve. Real world problems have more space to explore in, so I suggest you expand the problem. Commented Jan 14, 2016 at 21:32
  • I know this isn't exactly what you're looking for, but would Shamir's Secret Sharing en.wikipedia.org/wiki/Shamir%27s_Secret_Sharing address your needs? Commented Jan 14, 2016 at 21:34

1 Answer 1


Assuming that all ciphertexts are of the same length (some tricky padding could help with different lengths), you can just XOR the plaintexts together:

C = M1 xor M2 xor M3
K1 = M2 xor M3
K2 = M1 xor M3
K3 = M1 xor M2
M1' = C xor K1
M2' = C xor K2
M3' = C xor K3
... and so forth for Mn and Kn

Important: even if the plaintext is unpredictable, this "encryption" scheme is very weak; do not use it for confidential data.

  • Clever, but not really an answer. Commented Jan 14, 2016 at 22:50
  • Because i am not giving a tool?
    – marstato
    Commented Jan 14, 2016 at 23:03
  • The OP is asking for a real solution, you are offering a toy. Commented Jan 15, 2016 at 1:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .