Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have some code that takes a list of credit-card numbers, splits the number into two chunks, one chunk is 8 characters long, the other chunk is the remainder.

Each series of chunks is saved into individual files, for example my test data looks like (these are test CC numbers):


So, file X would contain:


and file Y would contain:


Each record is separated by a common delimiter (a newline character).

File X is saved to a TrueCrypt volume using AES, and file Y is saved to a different TrueCrypt volume, also using AES, but using a completely unrelated key.

My question is, does doing this lower cryptographic strength due to this structure?

The reason why I bring this up is that if you know the contents of one file, you can make assertions about the contents of the second, due to credit-card numbers adhering to LUHN-10 (mod10) specifications.

For example, if I know file X's contents, I know the corresponding record in file Y must pass the LUHN-10 check, and therefore knowing file X exposes information about file Y, Y's potential value is reduced by a factor of 10.

Slightly off-topic, but does storing a single file with full credit card numbers separated by a common delimiter expose information, if the attacker knows the structure of the file?

share|improve this question
up vote 3 down vote accepted

No, it doesn't lower security, but it doesn't (asimptotically) enhances it either. AES (or better, as Thomas pointed out, the way aes is used inside Truecrypt) is secure against IND-CPA attacks, so the encryption of a file itself does not reveal ANY information about the plaintext, except for its length.

Even if an adversary knows 99 bits of a 100 bits encrypted file (but not the encryption key), it cannot find the last bit without iterating trough the whole set of keys. Knowing something about the plaintext does not help the adversary.

share|improve this answer
"AES" is certainly not IND-CPA secure. A probabilistic encryption scheme such as CBC, CTR, OFB, .. is. – Thomas Jan 22 '13 at 8:19
You are right. AES itself is just a (trapdoor) permutation. I think the way AES is used in Truecrypt (XTS mode) is IND-CPA. – antosecret Jan 22 '13 at 8:24
Indeed, it is IND-CPA secure - I just wanted to clarify that point. – Thomas Jan 22 '13 at 8:29
Thanks for the suggestion! I briefly updated the answer to include that, feel free to expand and edit it if you wish. =) – antosecret Jan 22 '13 at 8:32
Thank you, your last line "Knowing something about the plaintext does not help the adversary." was what I was looking for. – Matthew Jan 22 '13 at 14:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.