Tuesday, April 24, 2018

Yii2 cryptography

Yii2 cryptography

Generating Pseudo random

Pseudo random is helpful in security. You can use Pseudo random data as a token while sending the email for reset password or while sending the confidential data on the server.

$securityKey = Yii::$app->getSecurity()->generateRandomString();

You can also pass the integer value in generateRandomString() function.
For Example:

$securityKey = Yii::$app->getSecurity()->generateRandomString(10);

No comments:

Post a Comment