Integer encryption preserving equality I have read too many different options for encryption that I now feel quite lost. I need a simple, secure (don't we all) scheme for encrypting integers (32-bit) with the following requirements:


Ciphertext is also an integer (32-bit) or a long (64-bit)
For integers x1=x2 then ciphertexts E(x1)=E(x2)
For integers x1&lt;>x2 then ciphertexts E(x1)&lt;>E(x2)
If I know E(x1) it will be very hard to decrypt x1 without the (private) key


Is there such a simple scheme?
Some of your conditions are already met by the definition of an encryption scheme:


Encryption has to be reversible, so that a ciphertext can be the encryption of (at most) one plaintext.
Your last point is basically just a ciphertext only attack. That is usually the weakest considered attack, and for todays security definitions not enough. So any scheme which is considered secure, it also includes this.


The only non-trivial part is your first point, because it is not that easy to find an encryption scheme, which has ciphertexts of 32 or 64 bit length. Of course you could use 3DES (64 bit), but that should not be recommended any more today. But there are other options:


Stream ciphers don't expand the ciphertext. When choosing a stream cipher, use a current one, and consider to use keystream btis beginning after some threshold. RC4 is popular but has quite a few security problems.
Using a block cipher in OFB, CTR (or KFB) mode of operation functions very similar to stream ciphers, and you can just drop the bits you don't need.
Format preserving encryption is a method which enables you to have that 32 bit to 32 bit relationship. But there are a lot of constructions, and quite a few build upon the other mentioned methods.