In Magento 2, You can generate a unique hash token for your custom functionality where you need to pass id or variable as encrypted.
Magento uses this functionality, generate a unique hash token for reset password confirmation link.
If you want to do a generate unique token you need to use Core Magento\Framework\Math\Random class to accomplish your requirement. Continue reading “How to generate unique hash token in Magento 2?”