tags:

views:

136

answers:

3

well i want to encrypt 32bit integers so they are represented by another 32 bit integers
i am currently using des but the resulst is 64bit integer.
so is it possible to have a block cipher with 32 bit block so the output is 32bit integer?
i don't want to use Xor Encryptions as a last resort :)
thanks

+2  A: 

you can write all integers into single byte array and encrypt them, another idea is to use 64 bit integers, casting them to 32bit when needed.

alexm
i need the output block to be 32bit so all these technics wont work.
Karim
+3  A: 

This is the only 32-bit block cipher I am aware of: http://www.qualcomm.com.au/PublicationsDocs/skip32.c

For security, 64-bits is generally considered an absolute minimum block size.

GregS
thank you, got it too
alexm
32 bit block ciphers are not at all secure, for two reasons: after you send any more than 66,000 integers, the chance of sending a repeated value is more than 50%; and because building a complete table of all plaintext/ciphertext pairs is completely feasible.
caf
+1  A: 

To make something like this work securely with common ciphers, you'd can operate a block cipher in a "stream" mode like OFB, CFB, or CTR. This means you need to have a suitable (unpredictable) initialization vector for each integer you are trying to encrypt, or (in CTR mode) have a well-defined message order.

I'm assuming that you want to decrypt the numbers later. If you are just trying to create a pseudo-random generator with a period of 232, there are other techniques you can try.

erickson