-
-
Save gaodeng/cf71600c51d859e25fee1b70ed654a68 to your computer and use it in GitHub Desktop.
Generate a Laravel 5.x hash/token
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| use Illuminate\Support\Facades\Password; | |
| # Generate a token in the same style as laravels password reset tokens. | |
| # Will generate something like: 785f616c4978a87ad65a899ed4133b358a4697649c55b0965a7ebb7486bd9801 | |
| $token = Password::getRepository()->createNewToken(); | |
| # Laravels underlying token generation technique for the above is: | |
| # hash_hmac('sha256', Str::random(40), <your-app-key>) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment