简体   繁体   English

PHP Perl跨平台编码器/解码器

[英]php perl cross-platform encoder/decoder

it used to be that the perl encoder 曾经是perl编码器

use Crypt::CBC;
$cipher= Crypt::CBC->new( {'key' => $cipherkey,
             'cipher'=> 'Blowfish',
             'iv' => '12345678',
             'regenerate_key' => 0,
             'padding' => 'null',
             'prepend_iv' => 0
            });

could be nicely decrypted by the php function 可以通过php函数很好地解密

mcrypt_cbc(MCRYPT_BLOWFISH, $key, base64_decode($v), MCRYPT_DECRYPT, '12345678')

alas, mcrypt_cbc is not only deprecated now, it also disappeared from php7 altogether. m,mcrypt_cbc不仅现在已被弃用,它也从php7中完全消失了。

is there a recommended encoder in perl that the standard new php decoder mcrypt_encrypt works with? 在标准的新PHP解码器mcrypt_encrypt使用的perl中有推荐的编码器吗?

for my purposes, I do not need to be super-secret. 就我的目的而言,我不需要超级机密。 reasonably secret is ok. 合理的秘密是可以的。 no life-or-death secrets. 没有生死攸关的秘密。 if it takes half an hour to decode, it's good enough. 如果需要半小时才能解码,那就足够了。 ideally, I would use whatever the canonical security encoder decoder is (as long as they are compatible, of course). 理想情况下,我将使用任何规范的安全编码器解码器(当然,只要它们兼容)。

advice appreciated. 建议表示赞赏。

The docs point out you should use mcrypt_decrypt instead. 文档指出,您应该改用mcrypt_decrypt It appears PHP is phasing out mcrypt_cbc in favour of a more generic interface. 看来PHP正在逐步淘汰mcrypt_cbc ,以使用更通用的接口。 The following provides the same functionality: 以下提供了相同的功能:

mcrypt_decrypt(MCRYPT_BLOWFISH, $key, base64_decode($cipher_base64), MCRYPT_MODE_CBC, $iv)

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

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