douchungu0859 2016-06-05 19:35
浏览 50

Php不能以超过17的成本使用

I'm using php's crypt() to hash passwords. I decided to go with blowfish algorithm and use salt. Salts in crypt() determine algorithm so blowfish's salt begins with $2y$xx$ where xx is cost parameter in range 4-31 (Refer to http://php.net/manual/pl/function.crypt.php). I'm also using bin2hex and openssl random generator to get random salt. As I understand it setting it higher will require more computing time and make brute-force attack longer.

My problem is that I can't get my script to work with cost parameter set over 17. When ran from the browser page is loading approx 1min and then stops with blank page. Not even echo. Why is that? How could I use 30 instead of 17? Is this a matter of my php server settings ?

Here's code:

<?php
    $reps=17;
    echo 'pre';
    echo crypt('passwdMike',"$2y$".$reps."$".bin2hex(openssl_random_pseudo_bytes(22)));    
    echo 'post';
?>

Edit: I can go with higher factors from command line. 18 was under minute. 30 waiting over 10minutes now. So it's obviously too much and 12 will suffice.

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥15 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体
    • ¥88 实在没有想法,需要个思路
    • ¥15 MATLAB报错输入参数太多
    • ¥15 python中合并修改日期相同的CSV文件并按照修改日期的名字命名文件
    • ¥15 有赏,i卡绘世画不出
    • ¥15 如何用stata画出文献中常见的安慰剂检验图
    • ¥15 c语言链表结构体数据插入
    • ¥40 使用MATLAB解答线性代数问题
    • ¥15 COCOS的问题COCOS的问题
    • ¥15 FPGA-SRIO初始化失败