How to do Password hashing in cakephp 3 manually?

I am working on forgot password and i want to send the new password using rand() . After sending the password to customer email i want to update the new password with hashing but i do not know how ...