1

I know I'll get bashed for this, but here goes: For a project I'm doing, I have a single very important 2-bit integer that I need to encrypt (the "security level" of the program) as fast as possible, while ensuring integrity. However, it is using the same encryption password as certain data at rest. If I encrypt the data with AES-CBC without a difficult key derivation procedure, that would make it easier to bruteforce the key for the data at rest, which is not too good. However, if I do use a difficult key derivation procedure, that would make the program a lot slower.

Is there a way to encrypt less than one byte of data quickly and with integrity verification, without reducing the security of the key derivation? My current thoughts are that the easiest way to do this would be to combine an unpredictable single-byte encryption method with a hashing algorithm with a high collision rate.

  • 1
    How serious is your performance requirement? If the secrecy of your key is vital, you could pad your data with random bytes to fill one block. – Tom Sep 24 '17 at 5:03
  • If you don't have to use the same encryption as the other data, look to stream ciphers instead of a block cipher. – Tom Sep 24 '17 at 5:05
1

You would want to use an authenticated stream cipher, allowing you to encrypt data with individual bit granularity. I would recommend either AES-GCM if you have AES-NI or ChaCha20-poly1305 otherwise. Key derivation is an entirely different concept and which is done separately, before encryption begins.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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