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!

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.

1 Like


Can I use the security config mentioned in the answer of imanilchadhari with the function