tags:

views:

71

answers:

2

Quoting myforwik's answer, CBC, OFB and CFB are identical, however OFB/CFB is better because you only need encryption and not decryption, which can save code space.

I want a pure implementation of AES CFB in PHP. I specifically do NOT want mcrypt.

I therefore turned to PHPSecLib. However, as per the documentation, the library only supports ECB and CBC.

I do not think myforwik meant that CBC and CFB can be used interchangeably... So, a) is there a CFB implementation out there, or b) can I (easily) implement CFB mode from PHPSecLib's CBC implementation?

+1  A: 

CBC, OFB and CFB are not identical - though there are similarities. If they were identical, they would not have different names.

If you want AES + CFB, you cannot use AES + CBC to achieve the result. You will have to find a way to get AES + CFB implemented if it is not already available.

Jonathan Leffler
That's what I thought. That's b) taken care of, then.
passcod
@passcod: I've gone and annotated the x-ref.
Jonathan Leffler
A: 

Check out the latest CVS of phpseclib. It supports CTR, CFB and OFB, in addition to CBC and ECB. I assume the documentation will be updated when a new version is released.

fruzer
Thanks for pointing that out. I should always remember to check the repo, but sometimes time makes me forget...
passcod