简体   繁体   English

AES -192使用PHP进行加密/解密?

[英]AES -192 encryption/decryption using php?

I have done AES128 encryption/decryption in php using the AES128 script available at http://www.phpclasses.org/package/3650-PHP-A-pure-PHP-AES-128-encryption-implementation.html or http://www.phpclasses.org/browse/file/17721.html Now I have a key of 24 characters and data(already stored in database) is encrypted using the 24 character key. 我使用http://www.phpclasses.org/package/3650-PHP-A-pure-PHP-AES-128-encryption-implementation.htmlhttp:/上提供的AES128脚本在php中完成了AES128加密/解密。 /www.phpclasses.org/browse/file/17721.html现在,我有一个24个字符的密钥,并且数据(已经存储在数据库中)已使用24个字符的密钥加密。 So I am supposed to decrypt this data. 因此,我应该解密此数据。

I think it is AES-192 (correct me if am wrong) coz its 24 character key. 我认为这是AES-192(如果输入错误,请纠正我),因为它是24个字符的密钥。 Is it possible to modify the AES128.php code available at phpclasses(link is above) so that it can be used to decrypt AES192 encrypted data. 是否可以修改phpclasses上可用的AES128.php代码(上面的链接),以便可以将其用于解密AES192加密数据。 Please help.. 请帮忙..

I wouldn't try modifying to code yourself if you don't know much about cryptography. 如果您对密码学不太了解,我不会尝试修改自己的代码。 Chances of getting something wrong are pretty high. 出错的可能性很高。

If you're free to change the AES implementation you use, why not use the PHP supplied mcypt module ( http://php.net/manual/en/ref.mcrypt.php )? 如果您可以随意更改使用的AES实现,为什么不使用PHP提供的mcypt模块( http://php.net/manual/en/ref.mcrypt.php )? It supports AES-128, -192, -256-bit (under the name MCRYPT_RIJNDAEL_xxx) and much, much more. 它支持AES-128,-192,-256位(名称为MCRYPT_RIJNDAEL_xxx)以及更多。 Plus, as a free bonus, you can find tons of code examples for it. 另外,作为免费赠品,您可以找到大量的代码示例。

Here is an example: http://www.php.net/manual/en/function.mcrypt-encrypt.php#78531 . 这是一个示例: http : //www.php.net/manual/zh/function.mcrypt-encrypt.php#78531

Use mycrypt and RIJNDAEL-192 cipher, it is the same than AES. 使用mycrypt和RIJNDAEL-192密码,与AES相同。

http://fr2.php.net/manual/fr/mcrypt.ciphers.php http://fr2.php.net/manual/fr/mcrypt.ciphers.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM