Is there a JavaScript library that does Rijndael 256 bit encryption like PHP?
I've used Rijndael 256-bit encryption in PHP extensively for my API and would like to use it for my API wrapper, which is also written in JavaScript, but I haven't been able to find a solution that gets the same result as in PHP.
What I mean PHP for:
base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256,$password,$secretInformation,MCRYPT_MODE_CBC,$iv));
and
base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256,$password,$secretInformation,MCRYPT_MODE_EBC));
.., as well as decryption options.
I know that many 256-bit AES libraries don't get the same result as PHP with its 256-bit Rijndael encryption, so I'm wondering if there is a library that can do what PHP does in the examples above?
Thank!
source to share
MCRYPT_RIJNDAEL_256 is not AES with a 256 bit key, its basically "AES" with a block size of 256 bits (AES is usually a block size of 128 bits). Rinjdael had many options and was standardized in AES, reducing these parameters to 128 or 256-bit key size. Thus, libraries must support the standard (AES), not prototype.
If you want AES 256 or 128, which almost all libraries support, use MCRYPT_RIJNDAEL_128 with 128-bit or 256-bit key. The difference in block size doesn't really make a significant difference in security.
Also, using a raw password as a key is really a very bad idea. You obtain keys from a password using a password-based key derivation function such as PBKDF2.
source to share