arbme
arbme

Reputation: 4941

Which encryption mode ECB, CBC, CFB

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

Upvotes: 3

Views: 3419

Answers (3)

Neel Basu
Neel Basu

Reputation: 12904

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.

Upvotes: 1

Accipitridae
Accipitridae

Reputation: 3194

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.

Upvotes: 3

Damien Dennehy
Damien Dennehy

Reputation: 4074

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

Personally I'd use CBC.

Upvotes: 1

Related Questions