duanpai9945 2014-07-31 09:35
浏览 58

php中的Blowfish选项

I use PHP 5.3.3 and is trying to do a blowfish encryption with these options:

The bytes of the encrypted data are hex-coded and left padded up to two characters with a zero. Blowfish ECB is used for encryption with a attached salt.

It's from an integration manual of EVO payments international (creditcard payments).

Can I use crypt()? (password_hash() is not available in 5.3)

  • 写回答

1条回答 默认 最新

  • dtnd30892 2014-08-01 13:11
    关注

    If anyone is looking for an answer to this, here is my solution:

    $cipher = mcrypt_module_open(MCRYPT_BLOWFISH, '', MCRYPT_MODE_ECB, '');
    $iv = '12345678'; //this is ignored when using MCRYPT_MODE_ECB
    mcrypt_generic_init($cipher, $blowfish_secret, $iv);
    $data_blowfish = mcrypt_generic($cipher, $datastring_to_encrypt);
    mcrypt_generic_deinit($cipher);
    return bin2hex($data_blowfish);
    

    It seems to work

    评论

报告相同问题?

悬赏问题

  • ¥15 vue3加ant-design-vue无法渲染出页面
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
  • ¥15 路易威登官网 里边的参数逆向
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
  • ¥50 需求一个up主付费课程
  • ¥20 模型在y分布之外的数据上预测能力不好如何解决
  • ¥15 processing提取音乐节奏
  • ¥15 gg加速器加速游戏时,提示不是x86架构
  • ¥15 python按要求编写程序