0

I have a sequence of 32-bit integer IDs, like 1, 2, 3, 4 and so on.

I would like to get encrypted text of these integers like ABCDEF12, 2310F120 and so on.

Additional requirements:

  • One bit change (for example from 1 to 2, or 1998 to 1999) should cause significant encrypted text change (for example ABCDEF12 to 2310F120).
  • Some kind of encryption key is welcome
  • Encrypted text should be as small as possible (so standard 80-bit encryption with source padding is not acceptable here).
  • Unambiguous decryption
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
oppox
  • 1
  • 2
  • If the encrypted text is very small, you'll be quite vulnerable to brute-force attacks. – SLaks Aug 19 '15 at 17:24
  • You can use any 32-bit block cipher. See linked question. – Eric J. Aug 19 '15 at 17:27
  • There's the old "multiply by an odd number" trick (an odd number has a modular multiplicative inverse modulo a power of two). But zero stays zero and 1 is transformed to the key so it's not very good. – harold Aug 19 '15 at 17:27
  • I understand, It is not a problem. Threats resistance is not a goal. – oppox Aug 19 '15 at 17:27
  • `Threats resistance is not a goal` Well then you can rotate the bits by a constant, known amount or use XOR encryption. However, I would still recommend going with a 32 bit block cipher (if resistance is a non-issue, why not go with 1=1, 2=2, etc?) – Eric J. Aug 19 '15 at 17:28
  • @EricJ. because of "one bit change should .. " etc – harold Aug 19 '15 at 17:29
  • But that requirement describes an aspect of thread resistance. – Eric J. Aug 19 '15 at 17:31
  • The linked question does have good answers already. However, just to add to that there is a cipher published by the NSA in 2013 that can be used with block size 32 and key size 64 called Speck. Key size 64 can be brute forced even by modest adversaries, but as the rule goes, if your information is worth less to an adversary than the cost for him to get that information, you are probably secure. Speck will take 32 bits and turn it into 32 other bits, so there is no bloat. – WDS Aug 19 '15 at 20:17
  • @WDS I've added a comment with more ciphers that operate on 32 bit blocks to the accepted answer of that linked question. I like the flexibility of HPC, but Speck/Simon are nice too. – Artjom B. Aug 20 '15 at 00:27
  • @ArtjomB.Thanks for the heads-up. I knew about a few of them, but Hasty Pudding I did not know, nor GDES. I think I might try playing around with HPC myself. Their complaint in AES about HPC was it is too slow because of its 64 bit operations. That shouldn't be an issue any more. For serious work it still has to be Rijndael, Serpent, or Twofish because they have been scrutinized more, but HPC does look interesting. – WDS Aug 20 '15 at 04:06

0 Answers0