views:

94

answers:

3

My php script and my c# application will pass a hash string to each other that is 32 chars long, what is the best mode for this? I thought ECB but am unsure as it says if using more then 1 block dont use. How do I know how big the block is?

They will occasionally pass a large text file, which would be the best mode for encrypting this...CBC?

Any good useful reads welcome...

Thanks

+1  A: 

ECB is the simplest mode and really not recommended (it's not quite as secure as other modes).

Personally I'd use CBC.

Damien Dennehy
+1  A: 

One problem of ECB (among many other problems) is that it encrypts deterministically. That is each time you encrypt the same ID, you get the same ciphertext. Thus this mode does not prevent traffic analysis. An attacker may not be able to learn the IDs that are encrypted. However, he can still determine when and how frequently the same ID is sent.

CBC and OFB when used properly use a new random IV for each encryption thus encrypting the same ID differently each time. Since you also make sure that all IDs have the same length the result should ciphertexts where the attacker cannot distinguish repeating IDs from non-repeating ones.

Accipitridae
+1  A: 

In Addition to Accipitridae's Answer. You would need to supply the IV to the decryption procedure. That will also be a overhead in case of CBC or OFB.