Default password crypt set to SHA512

Hi there,

I use the function Yii::$app->security->generatePasswordHash()

As far I’ve seen in the class yii\base\Security is a variable kdfHash which default value is SHA256. How can I set the default value to SHA512, e.g. in config.web?

Thank you!
T

I am not sure but you could try overriding the security component.

'components' => [
        ...
        'security' => [
            'class' => 'yii\base\Security',
            'kdfHash' => 'sha512',
            'macHash' => 'sha512',
        ],
        ...
]
1 Like

@imanilchaudhari is right.
Please check the API document.
https://www.yiiframework.com/doc/api/2.0/yii-base-security

1 Like

cheers!

Can I use the security config mentioned in the answer of imanilchadhari with the function
Yii::$app->getSecurity()->generatePasswordHash($password);?